Don's Tools · Developers · cURL to Code

cURL to code

Paste a curl command and get clean JavaScript fetch, Python requests or Node axios code, with headers, body and auth carried across, all in your browser.

cURL to Code converts a curl command into ready-to-use code in your browser. Paste the command and get clean JavaScript fetch, Python requests or Node.js axios, with the URL, method, headers, request body and basic auth all carried across, and JSON bodies formatted correctly for each language. Switch languages with the tabs and copy the result. Nothing you paste, including any keys in the command, ever leaves your browser.

Files are processed in your browser and never uploaded.

How to use cURL to code

  1. Add your text

    Type or paste your text into the input box. Everything is handled by your own browser, so nothing is sent to a server.

  2. Run it

    Press Python (requests) to produce the result.

  3. Copy or save it

    Copy puts the result on your clipboard.

What this tool does

Convert curl to fetch, requests or axios

Paste the curl command and get working JavaScript fetch, Python requests or Node axios back.

Carries across headers, body, method and auth

Headers, the request body, the HTTP method and basic or bearer auth are all carried across rather than quietly dropped.

Detects and formats JSON bodies

A JSON body is recognised and written out as an object in the target language instead of a quoted string.

Switch language with one tap

Switch language and the same command is re-emitted, so you can compare all three without pasting again.

Runs in your browser, nothing uploaded

The command is parsed in your browser. Nothing is uploaded, which matters because curl commands so often contain tokens.

Frequently asked questions

Is my command uploaded anywhere?

No. The curl command is parsed and converted entirely in your browser. Nothing you paste, including any tokens or keys in it, is sent anywhere.

Which languages can it convert to?

JavaScript using fetch, Python using the requests library, and Node.js using axios. Switch between them with the tabs and copy the one you need.

What parts of curl does it understand?

The URL, request method, headers, request body data, basic auth, cookies, user agent and referer. Common flags that do not affect the code, like compression or following redirects, are safely ignored.

Does it handle JSON bodies correctly?

Yes. If the data looks like JSON it is passed as a JSON body in each language, using JSON.stringify for fetch, the json argument for requests, and a data object for axios. Other bodies are sent as raw strings.

A flag was ignored, is that a problem?

Some curl flags only control curl itself and have no equivalent in a code request, so they are left out on purpose. The important parts, the URL, method, headers and body, are always carried across.

Last updated: