
curl to JavaScript fetch converter
Paste a curl command and get the same request as JavaScript fetch (or Python requests). It only reads the command: nothing is sent anywhere.
Runs in your browser. Pasted data never leaves it.
How to use it
- Paste a curl command (multi-line commands with backslashes are fine).
- Pick the language you want: JavaScript fetch or Python requests.
- Read the notes for anything that does not carry over, then copy the code.
- Use “What it sends” to see the method, URL, headers and body in plain terms.
Questions
Does it send the request?
No. It only reads the curl command and writes code. Nothing is run or sent, so it is safe to paste commands that contain tokens or cookies (though you should still treat those as secrets and not share the converted code).
Which curl options are supported?
-X, -H, -d / --data / --data-raw / --data-binary / --data-urlencode, --json, -F (multipart forms and file fields), -u, -A, -e, -b, -G, -I, -L, -k, -m, -x, --compressed and --url, plus bundled flags like -sSL and multi-line commands with backslashes. Options that only change curl's output (-s, -v, -o) are ignored, and unknown ones are listed as warnings.
Why doesn't the browser run my fetch code?
Browsers forbid setting some headers from a page (Cookie, User-Agent, Host, Referer and others), and cross-site requests need the server to allow CORS. The converted code works as-is in Node 18+, Deno and Bun. The notes under the code say when something won't work in a web page.
Why did it add redirect: manual / allow_redirects=False?
curl does not follow redirects unless you pass -L, but fetch and requests usually do by default. The converter matches curl's behaviour so your results agree; delete that line if you want to follow redirects.
How do I get a curl command from my browser?
Open the developer tools, go to the Network tab, right-click a request and choose Copy → Copy as cURL (bash). Paste it here. Remove cookies and tokens before sharing the result with anyone.
Is what I paste or test sent anywhere?
No. This page works entirely inside your browser, and pasted data never leaves your device. It makes no network requests while you use it, and the page also tells your browser to block them (a Content-Security-Policy with connect-src 'none'), so even a bug could not send your data out. To check it yourself, open your browser's developer tools, go to the Network tab, and use the tool: nothing will appear. There is no account, no analytics and no logging.
