Skip to content

cURL Converter

Turn a curl command into JavaScript fetch, axios or Python requests — headers, body, auth and forms included.

curl command

Nothing is sent anywhere

JavaScript fetch

Paste a curl command to turn it into code. Headers, body, auth, forms and cookies are all carried over.

Runs in your browser — nothing you enter leaves this device.

About this tool

What it does

The cURL converter turns a curl command into working code for JavaScript’s fetch, the axios library or Python’s requests. It reads the command the way a shell and curl would: quotes and backslashes are handled as bash handles them, -d makes a POST with a form content type, several -d options are joined with &, -G moves the data into the query string, -u becomes HTTP Basic authentication and short options can be combined, as in -sSL or -XPUT. The most common source is a browser’s developer tools — right-click a request in the Network tab and choose Copy as cURL — or the examples in an API’s documentation.

How to use it
  1. Paste the curl command on the left, including any line continuations, or press “Try an example”.
  2. Choose fetch, axios or Python above the result.
  3. Check the “Not carried over” list, if there is one: it names every option the code does not reproduce, such as a proxy or a body read from a file.
  4. Copy the code and replace any placeholders, such as <contents of body.json>, with the real values.
Limits and your data
  • Files are not read. A body from -d @file, a form field from -F name=<file or headers from -H @file become clearly marked placeholders; a file upload with -F name=@file becomes a FormData field (fetch, axios) or an open() call (Python).
  • Redirects: curl follows them only with -L. fetch, axios and requests follow them by default, so the code may follow a redirect the command would not have.
  • -k (skip certificate checks) has no browser equivalent. Python gets verify=False and axios a comment; fetch cannot do it at all.
  • Proxies, client certificates, timeouts, retries and output options (-o, -w) are not translated; each one that appears is listed.
  • Commands for Windows cmd.exe that use ^ for continuation are accepted; its other escaping rules are not, so a command copied “as cURL (cmd)” may need the bash version instead.
  • The command is read and converted in your browser and never sent anywhere — not to us and not to the URL in it. Commands copied from a browser often contain session cookies and tokens, so this matters; still, remove them before sharing the result.

Questions

Why does my POST have a Content-Type I did not set?

Because curl sends one. A plain -d sends application/x-www-form-urlencoded unless you set another type, so the code sets it too, to make the request identical.

Why is the JSON body an object rather than a string?

When the body is JSON — sent with --json or with a JSON content type — the converter parses it and writes it as an object, so it is easy to edit. fetch serialises it with JSON.stringify, axios and requests do it for you.

What happens to the Basic auth from -u?

axios and requests have an auth option, so it goes there. fetch has none, so it becomes an Authorization header with the credentials Base64-encoded, which is exactly what curl sends.

Is it safe to paste a command with my token in it?

Nothing leaves your browser. The token will appear in the generated code, though, so treat that code as a secret until you move the token into an environment variable.