How to use
Paste a `curl ...` command — single line or multi-line with backslash continuation, with quotes around values, whatever shape the API docs gave you. The parser splits it into method, URL, headers, body, and auth, then emits the equivalent snippet in JavaScript fetch, axios, Python requests, and Go `net/http`. Switch tabs to pick the target language, copy the snippet, and paste it into your code editor.
Reach for this when an API doc gives a curl example and your stack speaks something else, when you reverse-engineer a browser network request (right-click → Copy as cURL in Chrome / Firefox DevTools), or when you draft a request in Postman / Insomnia and want to commit the equivalent code. The conversion handles the common options (`-X`, `-H` with multiple headers, `-d` / `--data` / `--data-raw`, `-u` for basic auth, `--form` for multipart, line continuation with `\`), but always verify the output runs cleanly — every language has its own escaping rules and a curl-to-code translator can only guess at the intent of unusual flag combinations.
FAQ
My DevTools "Copy as cURL" output is huge — does it all matter?
Most of it is browser-automatic headers — `User-Agent`, `Accept-Language`, `sec-ch-ua-*`, `Cookie`, `Origin`, `Referer`, the lot. Strip them down to the ones the server actually requires (usually `Authorization`, `Content-Type`, and any custom `X-...` headers). The cookie header in particular is session-bound and will stop working after you log out; for server-to-server replication, get a proper API token instead. The converter outputs everything you give it, so curate the input.
What about `--data-raw` vs `--data` vs `--data-binary`?
All three send a request body. **`--data` / `-d`** strips embedded newlines and `\r\n`, which is fine for form-urlencoded but corrupts JSON or anything with intentional whitespace. **`--data-raw`** preserves everything literally — what Chrome DevTools outputs by default. **`--data-binary`** also preserves everything and additionally avoids any Content-Type guessing — used for file uploads via stdin or binary blobs. For 99% of API calls, `--data-raw` is what you want; the converter treats all three equivalently as the request body.
Does the output handle TLS / cert flags like `-k` or `--cert`?
Partially. `-k` / `--insecure` (disable cert verification) maps to `rejectUnauthorized: false` in Node, `verify=False` in Python `requests`, and `InsecureSkipVerify: true` in Go — flagged but mirrored. Client cert flags (`--cert`, `--key`, `--cacert`) are far less portable across languages and the converter usually marks them as a comment so you wire them up by hand. None of these should be in production code without security review.
The converted code does not work — why?
Common causes. **CORS**: browser fetch enforces same-origin and preflight rules that curl ignores; a curl that works from terminal may fail in browser without server cooperation (`Access-Control-Allow-Origin`). **Cookie scope**: browser fetch sends only the cookies the page is allowed to see; curl with `-b` sends whatever you wrote. **Compression**: curl decompresses gzip / brotli responses automatically with `--compressed`; fetch and `requests` need explicit handling. **Redirects**: curl follows `-L` only when told; some target libraries follow by default. Always run the snippet once, compare the actual response to curl, and adjust headers / options to match.
Why is the Python output sometimes `requests` and sometimes `httpx`?
This tool emits `requests` by default — it is the most widely used and the most likely to be already installed. For async or HTTP/2 contexts `httpx` is the modern choice with a near-identical API, and some converters offer both. If you need to call from `asyncio`, swap `requests.post` for `httpx.AsyncClient().post` — the rest of the call is the same. The Go output uses `net/http` (stdlib) rather than `resty` or other third-party clients for the same reason: no dependency to install.
Can it convert in the reverse direction (code → curl)?
Not here — this tool is one-way curl → code. For the reverse, Postman exports any saved request as curl, the Chrome DevTools network panel does the same for any captured request, and Insomnia / Bruno offer the same. Programmatic code → curl is rare because each language's HTTP library has features curl lacks (interceptors, connection pools, middleware) that don't round-trip; a curl from "the request that fires" rather than "the source code" is more reliable.
Related concepts
curl (1997, Daniel Stenberg) is the lingua franca of HTTP — a command-line client that ships in every Linux distro, macOS, Windows 10+, Docker base image, and CI runner. Its syntax doubles as documentation: every HTTP request can be expressed as a one-line curl invocation, which is why API docs at Stripe, GitHub, Twilio, AWS, and almost everyone else use curl examples regardless of what the underlying SDK looks like. Converting from curl is converting from the documentation's native form into yours.
The parsing is harder than it looks. Shell tokenization (quotes, escapes, backslash line continuation, `$variable` substitution) happens before curl ever sees its arguments, so a robust parser has to imitate enough of POSIX shell to split the input correctly. Then each flag has its own semantics — `-d` switches to POST and sets a Content-Type, `-G` reverses that to GET with query params, `-H` is repeatable, `-u user:pass` produces a Basic Auth header, `--data-urlencode key=value` URL-encodes the value before sending. Production converters maintain a flag table sourced from `man curl`; this tool covers the 30 or so flags that appear in 99% of real-world curl commands.
Three adjacent ideas matter. **OpenAPI / Swagger** describes the same request abstractly enough that any code generator can emit clients in dozens of languages — the systematic answer to the one-off curl-to-code problem. **HAR (HTTP Archive)** is the JSON format browsers export when you "Save all as HAR" in DevTools; it preserves the full request / response with headers and bodies and converts cleanly to curl or code via tools like `har2curl`. **Postman / Insomnia / Bruno** are the GUI version of the same workflow — paste curl, get a request you can edit, export to multiple languages. This converter sits between curl and editor code, the simplest of those forms.