Skip to content
ToolMug

cURL to Code Converter

Paste a curl command, for example one copied from your browser's developer tools, and get the same request as ready-to-run code. Headers, JSON bodies, form uploads and authentication are carried over; nothing is sent anywhere.

Runs in your browser — nothing you enter is uploaded

In Chrome or Edge DevTools, right-click a request in the Network panel and choose Copy → Copy as cURL (bash or cmd).

How to use

  1. Paste a curl command, or load the sample.
  2. Choose JavaScript fetch, Node.js axios, Python requests or Go.
  3. Copy the generated code into your project.

Options explained

Supported options
-X, -H, -d / --data-raw / --data-binary / --data-urlencode, --json, -F, -u, -b, -A, -e, -G, -I, -L, -k and --compressed, in short, long or --option=value form. Output-only flags such as -s, -v and -o are ignored.
JSON bodies
A body sent with a JSON content type is turned into an object literal, such as json=payload in Python, so it is easy to edit.
Redirects
curl does not follow redirects unless you pass -L. The generated code keeps that behaviour, for example allow_redirects=False in Python.

Example

This command, as copied from a browser:

curl -X POST https://api.example.com/v1/users \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer TOKEN' \
  -d '{"name":"Ada","age":36}'

becomes this with fetch:

const response = await fetch("https://api.example.com/v1/users", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer TOKEN",
  },
  body: JSON.stringify({
    "name": "Ada",
    "age": 36
  }),
  redirect: 'manual',
});

and this with Python requests:

response = requests.post("https://api.example.com/v1/users", headers=headers, json=payload, allow_redirects=False)

In Python the Content-Type header is left out of headers because the json= argument sets it. redirect: 'manual' and allow_redirects=False keep curl’s default of not following redirects.

Frequently asked questions

How do I get a curl command from my browser?

Open developer tools, go to the Network panel, right-click a request and choose Copy → Copy as cURL. Both the bash and the Windows cmd formats are understood.

Are my tokens or cookies sent anywhere?

No. The command is parsed in your browser; nothing is executed or uploaded. Remember to remove secrets before sharing the generated code.

Why is an option reported as unsupported?

Options that change how the request is made but have no simple equivalent, such as client certificates or proxies, are not converted. Remove them and add the setting by hand.

Privacy

This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.

Related tools