🌐

cURL to fetch

Convert cURL commands into JavaScript fetch code

🧑‍💻 Developer ToolsFreeRuns in your browser

fetch() code

—
Supports -X/--request, -H/--header, -d/--data variants, -u/--user, and plain URLs. Multipart -F uploads are detected and shown as a FormData placeholder you still need to fill in.

About the cURL to fetch

The cURL to fetch Converter rewrites a copied cURL command as browser or Node fetch code. It reads the method, URL, headers, and body, then formats a ready-to-run request with sensible defaults.

Copying a request from API docs or DevTools is the usual starting point. Convert it once, then move secrets to environment variables before the code reaches a repository.

  • ✓Parses -X, -H, -d, and --url flags
  • ✓Pretty-prints JSON bodies
  • ✓Warns about multipart form uploads

How to use the cURL to fetch

  1. 1

    Paste the cURL command.

  2. 2

    Choose whether to wrap it in an async function.

  3. 3

    Convert and copy the fetch code.

Frequently asked questions

Why does the generated code fail in a browser?+

Many cURL commands include server-side headers or secrets. Browsers block some headers and cross-origin requests need CORS, so run the call from a backend when in doubt.

How are quoted arguments handled?+

Single and double quotes are both respected, including line continuations with a trailing backslash. Escaped quotes inside JSON still need care.

Save cURL to fetch to your favorites, or keep browsing developer tools.

Browse all 35 developer tools →