curl → fetch / axios converter — offline
Paste a curl command, get ready-to-use JavaScript — with your API keys staying on your device.
Convert curl to fetch or axios without leaking your API keys
Curl commands are dense with credentials by their nature. The command you want to convert is usually one you copied from a terminal, from an API provider's documentation, or from Chrome DevTools' "Copy as cURL" — and every one of those carries the request's real headers: bearer tokens, API keys, session cookies, Basic auth credentials.
Pasting that into an online converter uploads a working credential to a stranger's server. Parsing happens here in your browser instead: nothing is transmitted, the site has no backend, and a Content-Security-Policy blocks third-party requests. Both a fetch() and an axios() version generate live as you type.
Which curl options are understood
-X/--request— the HTTP method.-H/--header— any number of headers.-d/--dataand its variants, plus--json.-u/--user— converted into a Basic auth header.- Common no-ops such as
-sand-L, which have no meaning in a browser request and are simply dropped.
Multi-line commands with trailing backslashes work as pasted, which is how curl commands almost always arrive from documentation. Multipart -F uploads are not currently converted — those map onto FormData in a way that depends on what you are actually uploading.
What you get back
You get both a modern fetch() call and an axios() call, so you can take whichever your codebase already uses. JSON bodies are converted into real JavaScript objects rather than being left as escaped strings — which is the tedious part of doing this by hand, and the part most likely to introduce a quoting bug.
Two things to check before the code runs in a browser. Requests to another origin need CORS permission from the server; curl has no such restriction, so a command that works in your terminal can still fail in a page. And do not paste the API key straight into front-end code — anything in the browser is visible to the user, so keys belong on a server or in a proxy.
Related and equally local: JSON formatter for the response body, JWT decoder for the bearer token in the header, and URL encoder for query parameters.
How to convert a curl command to fetch or axios
- 1
Paste a curl command (multi-line with \ works).
- 2
fetch() and axios() versions generate live.
- 3
Copy the one your codebase uses.
curl → fetch/axios — frequently asked questions
Are my curl commands uploaded?
No — parsing happens in your browser. Curl commands routinely contain API keys and tokens in headers, which is exactly why they shouldn't be pasted into server-based converters.
Which curl options are understood?
-X/--request, -H/--header, -d/--data (and variants), --json, -u/--user (becomes a Basic auth header), plus common no-ops like -s and -L. Multipart -F isn't supported yet.
What code do I get?
Both a modern fetch() call and an axios() call, with JSON bodies converted to real objects instead of strings.