Account

What new tool do you want?

Developer Tools

cURL to Code Converter

Convert cURL commands into JavaScript fetch, Python requests or Go net/http code — headers, JSON bodies, auth and methods included.

How to use

  1. 1Paste a curl command (e.g. from your browser's 'Copy as cURL').
  2. 2Choose the target language and copy the code.

Frequently asked questions

How do I get a cURL command from my browser?

Open DevTools → Network, right-click a request and choose 'Copy → Copy as cURL (bash)'.

Which curl options are supported?

-X, -H, -d/--data/--data-raw, --json, -u, -A, -b, -e, --url and -I. Flags like -s, -L, -k and --compressed are accepted and ignored.

Is my command sent anywhere?

No. Conversion happens in your browser — useful since copied commands often contain cookies and API keys.

A worked example showing per-language idioms, not just syntax swaps

curl -X POST https://api.x.io/items -H 'Content-Type: application/json' -d '{"name":"box","ok":true}' converted to Python doesn't just paste the JSON string into the request — it actually parses the JSON body and re-emits it as a native Python dict with True (capitalized, Python style) instead of JSON's true, then passes it via requests' json= parameter rather than data=, which makes requests set the Content-Type header automatically and serialize correctly. The same command converted to JavaScript produces a fetch() call with JSON.stringify(...) wrapping a proper object literal. Each target language gets the idiomatic way to send a JSON body in that ecosystem, not a mechanical string substitution.

Why Basic auth shows up as a header, not a separate parameter

Passing -u user:pw doesn't appear in the generated code as some special authentication parameter — it gets base64-encoded client-side (btoa("user:pw")) and inserted as a literal Authorization: Basic ... header, exactly matching what curl itself does under the hood and exactly how HTTP Basic auth actually works at the protocol level. This is also a genuine piece of security awareness baked into the output: Basic auth credentials are just base64 (trivially reversible, not encrypted) riding along in a plain header, which is worth seeing explicitly rather than hidden behind a convenience parameter that might make it look more secure than it is.

Why copied cURL commands are exactly the input you don't want sent to a server

A command copied from DevTools' "Copy as cURL" often embeds live session cookies, bearer tokens, or API keys from whatever page you copied it from — pasting that into a tool that forwarded it to a backend server would mean handing over active credentials to a third party. Because the shell-parsing and code-generation logic here runs entirely as JavaScript in your browser tab, the command and everything inside it (cookies, keys, request bodies) never leaves your machine, which is precisely why this kind of tool needs to be client-side to be trustworthy for real debugging use.

The language menu opens on fetch, and a bad command names the reason

Language opens on the fetch choice. Python requests and Go net/http are the other two. The box starts with a sample POST that sends a JSON body and a content-type header. A command I cannot parse stops and shows the reason, instead of a half-translated snippet. I switch the menu after a successful read and the same command is written again in the other language. I use that when a snippet I copied from a terminal will not parse and I need the message, not a blank editor. I fix the command before I switch languages.

Related tools

More: Developer Tools