Developer Tools

curl to fetch, Python and axios.

Paste a curl command, for example one copied from your browser's dev tools or an API doc, and get equivalent JavaScript or Python code. Headers, JSON bodies, basic auth and form fields are carried over. The command is never sent anywhere.

How to convert a curl command to code

  1. Paste a curl command, for example one copied from your browser's developer tools with Copy as cURL, or from API documentation.
  2. Choose the target: JavaScript fetch, JavaScript axios or Python requests.
  3. Copy the generated code into your script.

Check before you run it

The converter carries over the method, URL, headers, JSON bodies, form fields, basic authentication, cookies and the user agent, but it cannot run the request or know what a server will do. Read the generated code and run it against a test endpoint first. Commands copied from a browser often include dozens of headers, cookies and tracking values you do not need, so strip them down to the ones the API actually requires.

Treat any command from a browser as secret. It may contain session cookies, bearer tokens and API keys that grant access to your account, and pasting them into a script that you share or commit can leak them. Replace credentials with environment variables in the code you keep.

Your command never leaves this page

The converter runs in your browser, inside an isolated frame on this page that has no network access. Your file is read and written back by your own device, so it is not uploaded to TNAADO or anyone else, and nothing is stored. The advertising on this page sits outside the frame and cannot see what you choose. Commands often contain tokens, so the conversion happens entirely in the frame and nothing is sent to a server.

About this curl converter

API documentation and browser dev tools ("Copy as cURL") give requests as curl commands. This tool turns one into code you can paste into a script: JavaScript fetch, axios, or Python requests.

What is carried over

What is not converted

Options with no direct equivalent, such as proxies, timeouts, cookie jars, client certificates and output files, are listed as warnings instead of being silently dropped. Output is meant as a starting point: review it before running it, especially anything involving credentials.

Privacy

curl commands often contain API keys and tokens. Conversion happens in your browser, and the isolated tool frame loads no advertising or analytics scripts and allows no outside network requests.

Source

Worked example

Input command, converted by running this page’s converter code on 2026-10-26:

curl -X POST https://api.example.com/v1/items -H 'Content-Type: application/json' -H 'Authorization: Bearer TOKEN' -d '{"name":"widget","qty":3}'

It is read as POST https://api.example.com/v1/items with a JSON body. The fetch output:

fetch("https://api.example.com/v1/items", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer TOKEN"
  },
  body: "{\"name\":\"widget\",\"qty\":3}",
  redirect: "manual"
})
  .then((res) => res.text())
  .then(console.log);

The python output:

import requests

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer TOKEN',
}

json_data = {
    'name': 'widget',
    'qty': 3,
}

response = requests.request('POST', 'https://api.example.com/v1/items', headers=headers, json=json_data, allow_redirects=False)
print(response.text)

Sources and as-of date

As of 2026-10-26. The option meanings come from the curl manual and the generated fetch call follows the Fetch Standard. Replace TOKEN and similar placeholders before you run any generated code.

Frequently asked questions

How do I convert a curl command to Python?

Paste the command, choose Python (requests) and copy the code. JSON bodies use the json= argument so requests sets the right encoding.

How do I get a curl command from my browser?

Open dev tools, go to the Network tab, right-click a request and choose Copy as cURL. Paste it here. Remove cookies and tokens before sharing the result.

Is my curl command sent to a server?

No. It is parsed in your browser and this page blocks outside network connections.

Advertisement
Advertisement