Free cURL to fetch Converter
Paste a curl command · from API docs or your terminal · and get clean JavaScript fetch code with headers and body intact.
100% client-side · nothing you enter is ever sent to a server or stored.
Preview · sign in with a free account to run it
How to use it
- Paste a curl command from API docs or your browser's network panel (Copy as cURL).
- Read the generated fetch() call, with method, headers and body.
- Move any key or token into a server-side environment variable before you use the code.
Example
Input
curl -X POST https://api.example.com/v1/items \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"name":"Widget","qty":2}'Result
const res = await fetch("https://api.example.com/v1/items", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer $TOKEN",
},
body: "{\"name\":\"Widget\",\"qty\":2}",
redirect: "manual",
});What gets converted
- -X, -H, -d / --data / --data-raw, --json
- Become method, headers and body.
- -u user:pass
- Becomes an Authorization: Basic header.
- -F
- Becomes a FormData body.
- -L
- Without -L, curl doesn't follow redirects, so the code uses redirect: "manual" to match. With -L it follows them.
- Ignored flags
- Flags with no fetch equivalent are listed under the code instead of breaking it.
Go deeper
Page updated
Frequently asked questions
Which curl flags are supported?
The ones API docs actually use: -X/--request, -H/--header, -d/--data/--data-raw, --json, -F/--form, -u/--user (Basic auth), --compressed, and -L. Exotic flags are ignored with a note rather than breaking the output.
Careful: where does the API key in my curl command end up?
In your generated fetch code · and if you paste that into frontend code, the key ships to every visitor. Keys belong in server-side code or edge functions; run a scan if you're not sure what your app exposes.
Can I put the generated code in my React app?
Only if the request carries no secret. Anything in frontend code reaches every visitor's browser, so an Authorization header with a real key belongs in a server or edge function.
Want the full picture?
This tool covers one narrow check. A full SimplyScan runs 60 checks across 14 categories · exposed keys, RLS, XSS, auth, and speed · in 30 seconds.
Run a full security scanRelated tools
Markdown to HTML
Write or paste Markdown and get clean HTML plus a live preview · headings, lists, links, code blocks, and tables included.
XML Formatter
Paste XML · a sitemap, RSS feed, SVG, or API response · and pretty-print, minify, or validate it instantly.
Text Diff Checker
Paste two versions of a text or file and see exactly what changed · line-by-line, with additions and removals highlighted.