Tools › Build › cURL to Code Converter
$_

cURL to Code Converter – fetch, Axios, PHP & Python

Paste any cURL command and get clean, ready-to-run code for JavaScript fetch, Axios, PHP or Python — all in your browser.

✅ 100% Private
⚡ Instant Results
🧩 5 Languages
$_

Paste your cURL command

Works with “Copy as cURL” from Chrome, Firefox, Safari, Postman and API docs.

0 characters
{ }

Converted code

Pick a language — the code updates as you type.


Paste a cURL command above to see the converted code.
Advertisement

How to use

  1. Copy a cURL command from your browser DevTools, Postman or API docs.
  2. Paste it into the box — the code appears automatically.
  3. Choose JavaScript fetch, Axios, PHP cURL, PHP file_get_contents or Python requests.
  4. Copy or download the snippet and check any warnings shown below it.

What does this converter support?

It understands the options developers use most: -X, -H, -d / --data / --data-raw / --data-binary / --data-urlencode, -F multipart forms, -u basic auth, --json, -b cookies, -A, -e, -G, -I, -L, -k, --compressed and -m. It also handles quoted strings, $'…' escapes, line continuations (\, ^ and backtick) and combined flags like -sSL. Options that have no meaning in code (such as -v or -o) are listed as ignored so nothing happens silently.

Everything runs in your browser — your commands, tokens and payloads are never sent to a server.

Frequently asked questions

How do I get a cURL command from my browser?

Open DevTools → Network, right-click the request and choose Copy → Copy as cURL (bash). Paste it here. Use "cmd" format only if you copied from Windows; this tool understands both.

Why does fetch ignore my Cookie, User-Agent or Referer header?

Browsers treat these as forbidden header names and silently drop them. The generated code works as-is in Node.js 18+, but in a browser you must rely on the browser's own cookies and headers.

Does it convert -d @file?

Reading a body from a local file cannot be expressed in browser code, so the tool keeps the @file reference and warns you. Replace it with the file contents or a file-reading call for your platform.

What happens with shell variables like $TOKEN?

They are kept exactly as written, because the tool cannot know their value. Replace them with real values or your language's environment-variable lookup.

Is it safe to paste API keys?

The conversion happens locally in your browser and nothing is uploaded. As a habit, still replace production secrets with placeholders before sharing the generated code.