cURL to Fetch Converter
Paste any cURL command and get clean JavaScript fetch() code — headers, body, auth and all.
This tool runs 100% in your browser. Your data is never uploaded, stored, or logged.
JavaScript fetch()
About this tool
Every API doc gives you a cURL command; your frontend needs fetch(). This converter parses the real cURL syntax — -X, -H, -d, -F, -u, -G, quoted arguments, line continuations — and emits idiomatic fetch code with proper headers, JSON bodies and error handling.
Choose async/await or promise chains to match your codebase.
How to use it
- Copy a cURL command from any API documentation.
- Paste it into the input.
- Toggle async/await if you prefer promise chains.
- Copy the generated JavaScript into your project.
Useful ways to apply it
- Converting API doc examples into working frontend code in seconds.
- Migrating shell scripts to Node.js.
- Teaching teammates what a cURL flag translates to in fetch options.
- Prototyping API calls in the browser console.
Frequently asked questions
Which cURL flags are supported?
-X/--request, -H/--header, -d/--data (and variants), -F/--form, -u/--user, -G/--get, -A, -e, -b/--cookie, --url, --compressed, -k, -I and more. Unknown flags are safely ignored.
How is JSON detected?
If the body parses as JSON or the Content-Type mentions json, the converter emits body: JSON.stringify({...}) with the object expanded for readability.
What about file uploads?
-F form fields become FormData appends; @file references get a placeholder comment showing where to attach your File object.
Privacy
This tool runs 100% in your browser. Your data is never uploaded, stored, or logged.