cURL to Fetch Converter

Convert cURL commands to JavaScript fetch() API calls. Supports headers, body, auth, and more. Runs in your browser.

About cURL to Fetch

Paste any cURL command and instantly get equivalent JavaScript fetch() code. Supports -X (method), -H (headers), -d (body), -u (basic auth), -L (redirects), and more. Choose between async/await or .then() chain output styles.

Features

  • Parse cURL flags: -X, -H, -d, -u, -L, --data-raw, and more
  • Generate async/await or .then() chain code
  • Automatic method detection from body presence
  • Basic auth conversion to Authorization header
  • JSON body detection and formatting
  • Toggle header inclusion
  • 100% client-side — nothing is uploaded

How to use

  1. 1Paste your cURL command in the input panel.
  2. 2Choose async/await or promise chain style.
  3. 3Click Convert to generate fetch() code.
  4. 4Copy the output for use in your project.

Frequently Asked Questions

Which cURL flags are supported?
Common flags: -X (method), -H (headers), -d/--data/--data-raw (body), -u (auth), -L (follow redirects), -k, -s, --compressed. Cookies (-b) are parsed but not emitted.
Does it handle multiline cURL commands?
Yes. Backslash-newline line continuations are handled automatically, so you can paste cURL commands copied from browser DevTools directly.
Can I get TypeScript output?
The generated code is valid TypeScript as-is. The fetch() API has built-in type definitions in modern TypeScript projects.
Is my data sent to a server?
No. All parsing and code generation runs entirely in your browser. Nothing is uploaded or stored.

Related Converters

Explore other tools