JSON-Utils

cURL to Fetch

Paste a cURL command copied from docs, DevTools, or a terminal, and get equivalent JavaScript fetch code. Method, headers, basic auth, and body are carried over; flags that have no fetch equivalent are dropped and listed.

cURL command
JavaScript fetch
Result will appear here
Ready. Press Convert or Ctrl+Enter.

How to use the cURL to Fetch

  1. Paste a full cURL command.
  2. Press Convert.
  3. Copy the fetch code into your project.

Example

Headers and the JSON body carry into the fetch options.

curl -X POST https://api.example.com/items -H "Content-Type: application/json" -d '{"name":"Ada"}'

Frequently asked questions

Which cURL flags are understood?

-X/--request, -H/--header, -d/--data variants, -u/--user, and the URL. Cookie jars, client certificates, and proxy flags have no fetch equivalent.

Does it run the request?

No. It only converts the command to code. Use the API Client to send a request.