Developer Tools

cURL to fetch(), Axios and TypeScript Converter

Paste a curl command copied from Chrome DevTools, Postman or API docs and get working fetch(), Axios or typed TypeScript code, updated as you type. Headers, JSON bodies, form data, cookies and basic auth are all converted, not just the URL. Everything happens in your browser, so tokens in the command never leave your device.

cURL to fetch, Axios and TypeScript Converter

Free · No sign-up
Loading tool…

A free curl to fetch() and Axios converter

Browsers and API tools make it easy to copy a request as curl, but turning that back into working JavaScript by hand means re-typing every header and guessing at the body format. This converter reads the whole command, including flags most other tools skip, and writes a ready-to-run fetch() or Axios call. It's one of our free developer tools that run in your browser, with no sign-up and no limits.

Multi-line commands with the trailing backslash that Chrome's “Copy as cURL” adds are handled automatically, so you can paste the command exactly as copied, without first joining it into one line.

Headers, JSON bodies and form data, not just the URL

A lot of curl converters only handle the simple case: a URL and maybe one header. This one reads every -H header, JSON sent with -d or --data-raw, URL-encoded form fields, and multipart uploads from -F, including file fields, which come through as a clearly marked placeholder for the real File object. Basic auth from -u becomes a proper Authorization header, and -b cookies and -A user agents are converted the same way.

Flags that don't change the actual request, like --compressed, -L or -k, are recognised and quietly ignored rather than breaking the conversion, and anything the parser doesn't recognise is listed so you know exactly what wasn't translated.

Typed TypeScript output, not just JavaScript

The TypeScript tab wraps the same fetch() call in a typed async function, with a RequestBody interface generated from the JSON body you pasted, since that shape is already known. The response shape isn't knowable from a curl command alone, so that part is left as a clear placeholder instead of a guess: paste a real response into our JSON to TypeScript converter to generate a proper type for it in seconds.

Converting a curl command with a bearer token or API key

Authorization headers carrying a JWT are common in copied curl commands. If you want to see who a token belongs to or when it expires before you build it into your app, paste it into our JWT decoder — like this converter, it never sends the token anywhere.

Keeping request code consistent across a team

Once you have a working fetch() or Axios call, it's worth deciding once how your whole codebase should make requests, error handling included, rather than re-deciding it in every file an AI coding assistant touches. Our CLAUDE.md and AGENTS.md generator builds a rules file that can include exactly that kind of convention.

Frequently asked questions

Does it convert curl commands copied from Chrome DevTools?

Yes. Chrome's “Copy as cURL” output, including the multi-line backslash continuations, is handled automatically — paste it exactly as copied.

Can it convert file uploads (curl -F)?

Yes. Form fields from -F become FormData.append() calls, and file fields (name=@file) come through as a clearly marked placeholder line for the real File object, since a curl command can't carry an actual file.

Does it support TypeScript, not just JavaScript?

Yes. The TypeScript tab adds a typed async function and a RequestBody interface generated from the JSON body you pasted.

Is my curl command or token uploaded anywhere?

No. Parsing and code generation both happen in your browser. Nothing in the command, including tokens, passwords or cookies, is sent to a server.

What about basic auth from curl -u?

It's converted into a proper Authorization: Basic header with the credentials encoded, the same way curl itself would send them.

Can it convert PUT, PATCH or DELETE requests?

Yes. The method comes from -X / --request when it's set, or is inferred as POST when there's a body and GET when there isn't.

What happens with a flag it doesn't recognise?

Flags that don't change the request (like --compressed or -L) are ignored silently. Anything else is listed under the input so you can see exactly what wasn't translated.