cURL Converter

cURL Converter
Paste a command straight from DevTools → Network → Copy as cURL. Line continuations and mixed quoting are handled.

cURL command

Browser and Node 18+ — no dependencies
// Paste a cURL command on the left

Copy a request out of your browser DevTools and get working code for it. Paste the cURL command; get fetch, axios, Python requests or Go, plus a plain-language breakdown of what the command actually sends.

A curl command from browser DevTools or an API document carries everything a request needs, in a shell syntax that does not paste into a program. Translating it by hand is where headers get dropped and a JSON body gets its quoting mangled.

This converts a curl command into fetch, axios, Python requests or Go, keeping the method, headers, query parameters and body intact — including the multi-line quoting that "Copy as cURL" produces. Authorization headers and cookies come across as-is, which is worth remembering before pasting the output into somewhere shared.

The value of Copy as cURL is that it captures a request that actually worked, headers and all. That is also its risk: the command it produces carries every cookie the browser sent, any Authorization header, and session identifiers that are live until they expire. Pasting one into a chat, a ticket or a public issue hands over whatever those credentials open. The same applies to output generated from it here — the translated code contains the same values, and stripping them is worth doing before the snippet goes anywhere shared.

Shell quoting is where hand translation usually goes wrong. A JSON body inside single quotes is literal, so a dollar sign or a backtick inside it means nothing; the same body in double quotes is expanded by the shell before curl ever sees it. Multi-line commands joined by backslashes have to be reassembled before parsing, and Windows uses a different continuation character and different quoting rules again, which is why a command copied on one machine sometimes fails on another. Parsing the command properly rather than pattern-matching it is what keeps a body intact through the conversion.

Each target language has a shape of its own that a mechanical translation should respect. fetch does not set a JSON content type for you and does not throw on a 4xx or 5xx response, so the generated code checks the status explicitly. axios parses JSON and rejects on error status by default, which is the opposite convention. Python requests takes json= rather than a hand-serialised string, and Go needs an explicit request object with its body wrapped in a reader. The output follows each of those instead of transliterating curl flags one for one.

How to use cURL Converter

  1. In your browser, open DevTools → Network, right-click a request and choose Copy → Copy as cURL.
  2. Paste it into the left pane. Multi-line commands with backslash continuations are handled as-is.
  3. Read "Parsed request" to confirm the method, URL, query string, headers and body are what you expected.
  4. Pick a target tab — fetch, axios, Python, Go or normalised cURL — and copy the generated code.

Tips & gotchas

  • The Parsed request panel is worth reading even when you do not need the code. It breaks the query string out of a long URL and lists headers one per line, which makes a wrong Content-Type obvious.
  • Both quoting styles work, so a command copied from Windows cmd and one from a Unix shell both parse.
  • Flags that do not affect the request being sent — -s, -v, --compressed and similar — are recognised and ignored rather than mistaken for the URL.
  • A JSON body is pretty-printed in the generated code, and rewritten to Python literals (True/False/None) for the Python target.

Frequently asked questions

Are my headers and tokens sent anywhere?

No. Parsing and code generation happen entirely in your browser, so an Authorization header in a pasted command never leaves your machine. Still be careful about pasting production tokens into any tool, including this one.

Does it support file uploads?

-F/--form fields are parsed and emitted as FormData for JavaScript targets and as files= for Python. Actual file contents cannot be reproduced from a cURL command, so you will need to attach the file in code yourself.

Why is Basic auth written as btoa(...) instead of a literal header?

So you can see what is being encoded and swap in variables. For Python and Go the idiomatic form is used instead — auth=() and req.SetBasicAuth().