Free cURL to Code Converter

Free curl converter: paste a curl command with headers, data, JSON, auth or forms and get JavaScript fetch, axios, Python requests, PHP cURL or Node.js code.

  • No upload, 100% private
  • Instant, in your browser
  • 100% free, no signup
Loading tool…
Read the complete guideHow to Read a cURL Command and Turn It Into Fetch or Python Code →

About the cURL to Code Converter tool

API documentation, Stack Overflow answers and browser DevTools all speak curl. It is the universal way to describe an HTTP request, but your application is written in JavaScript, Python or PHP. Rewriting each header, the JSON body and the authentication by hand is tedious, and a missed quote or header is easy to overlook.

Paste a curl command here and it is converted instantly into JavaScript fetch, axios, Python requests, PHP cURL or Node.js https code. The parser understands -X, -H, -d and all its --data variants, --data-urlencode, --json, -u for basic auth, -F multipart form fields including file uploads, -b cookies, -A user agent, -G, -I, -k and -L, as well as single quotes, double quotes, $'…' strings and backslash line continuations.

JSON bodies are detected and output as native objects, so Python gets json= with True and None rather than a raw string. A summary lists the method, URL, header count, body type and any options that could not be translated, so nothing is silently dropped. Everything runs in your browser; the request itself is never sent.

How to use cURL to Code Converter

  1. Copy a request as cURL from your browser’s Network tab, or from API docs.
  2. Paste it into the “curl command” box, or click “Sample” to try an example.
  3. Choose a target tab: JavaScript fetch, Axios, Python requests, PHP cURL or Node.js https.
  4. Check the summary for the method, URL, body type and any ignored options.
  5. Click “Copy” or “Download” to use the generated code.

Features

Five output languages

fetch, axios, Python requests, PHP cURL and Node.js https (or fetch with FormData for uploads).

Real shell parsing

Handles single, double and $'…' quotes, escapes and multi-line commands copied from bash.

JSON aware

Detects JSON bodies and emits native objects, dictionaries or JSON.stringify calls.

Auth, cookies and forms

Converts -u basic auth, -b cookies and -F multipart fields including @file uploads.

Nothing hidden

Options that have no equivalent are listed as ignored instead of silently dropped.

When to use it

  • Turn a “Copy as cURL” request from Chrome DevTools into a Python scraping script.
  • Convert a Stripe, OpenAI or GitHub API example into fetch code for a web app.
  • Port a shell script’s curl calls into a PHP backend.
  • Reproduce a failing request from a bug report inside a Node.js test.
  • Teach how curl flags map to HTTP concepts in different languages.

Frequently asked questions

Which curl options are supported?

Method (-X), headers (-H), data (-d, --data-raw, --data-binary, --data-urlencode, --json), basic auth (-u), forms (-F), cookies (-b), user agent (-A), referer (-e), -G, -I, -k, -L and --url. Other flags are reported as ignored.

Is my API key sent anywhere?

No. The command is parsed with JavaScript in your browser and no request is made. Still, avoid sharing generated code that contains live tokens.

What happens with -d @file.json?

The browser cannot read files on your disk, so the @filename is kept as a placeholder string and listed in the ignored options for you to replace.

Why does fetch code not include cookies from -b?

It does: -b becomes a Cookie header. Note that browsers block setting the Cookie header from fetch, so that part only works in Node.js or server-side code.

Does it support Windows cmd curl syntax?

Commands using ^ line continuations are joined, but cmd’s different quoting rules are not fully supported. Copying as “cURL (bash)” from DevTools gives the most reliable result.

Related tools