cURL to Code

Paste a cURL command and get the equivalent fetch, Axios, Python requests or HTTPie code. Right-click any request in your browser's network panel, choose Copy as cURL, and paste it straight in — the quoting, escapes and backslash line continuations that come with it are all handled, because the command is read by a small shell tokenizer rather than split on spaces. That distinction matters more than it sounds: a whitespace split destroys any header or body containing a space, which is nearly all of them. The method is inferred exactly as cURL infers it, so a command with a data flag and no -X is correctly a POST rather than a GET. And anything that cannot be translated — certificate verification disabled, a proxy, an output file, a multipart form — is called out rather than quietly dropped. Nothing is executed.

Flags understood

FlagBecomes
-X / --requestThe HTTP method
-H / --headerA request header
-d and its four aliasesThe request body, POST if no -X
-u / --userBasic auth, split into username and password
-b, -A, -eCookie, User-Agent and Referer headers
-L / --locationFollow redirects
-k / --insecureReported — no browser equivalent
-F / --formReported — rebuild with FormData

When to use it

  1. Turn a request copied from DevTools into working fetch code.
  2. Port an API example from cURL into Python.
  3. Move a request from a terminal into an Axios client.
  4. Understand what a cURL command in someone's docs actually does.
  5. Check which headers a copied request is really sending.

How to Use

  1. Copy a request as cURL from your browser's network panel.
  2. Paste it in and check what was parsed.
  3. Choose fetch, Axios, Python or HTTPie and copy the code.

Features

  1. Real POSIX shell tokenizing, not a whitespace split
  2. Line continuations, including CRLF
  3. All the data and header flag aliases, plus --flag=value
  4. Bundled short flags such as -sSL
  5. cURL-accurate method inference
  6. Cookie, user-agent and referer folded into headers
  7. Untranslatable flags reported, never silently dropped
  8. Per-language escaping for fetch, Axios, Python and HTTPie
  9. Nothing executed, nothing uploaded

FAQs

Is the request sent?

No. The command is parsed and rewritten only. That matters here because commands copied from a network panel routinely contain session cookies and bearer tokens, and none of it leaves your browser.

Why do other converters mangle my command?

They split on whitespace. A cURL command is shell syntax, so a header like 'Content-Type: application/json' is one argument, not two. Anything containing a space, an escape or a line continuation needs a real tokenizer.

My command had no -X but came out as POST. Is that right?

Yes. cURL sends POST whenever a data flag is present and no method is given. Commands copied from a browser very often look like that, and treating them as GET is a common bug in other converters.

What happens to flags that have no equivalent?

They are reported. --insecure, --proxy, --output and -F all produce a visible note saying what was lost. Silently dropping --insecure in particular would produce code that behaves differently from the command you pasted, in a way that matters.

Does it handle multi-line commands?

Yes. Backslash line continuations, including the Windows CRLF form, are removed before parsing, so a command pasted across several lines works as-is.

Will the JSON body come out correctly?

Yes. JavaScript output is JSON-encoded rather than wrapped in whichever quote looked free, so a body full of double quotes escapes properly. Python switches to triple quotes when a value contains both quote styles.

Technical Details

The command is tokenised by a small POSIX shell reader rather than split on whitespace, which is the difference between a converter that works on real input and one that works on examples. A cURL command copied out of a browser's network panel arrives with single quotes, double quotes, backslash escapes and line continuations, and any header or body containing a space — which is to say most of them — is destroyed by a naive split. Single quotes are treated as fully literal, double quotes honour escapes only before a backslash, quote, dollar or backtick as the shell does, backslash-newline continuations are removed, and adjacent quoted runs concatenate. Flags are then read with their aliases: the five spellings of the data flag, both forms of header, the --flag=value form as well as --flag value, bundled short flags such as -sSL, and the positional URL which cURL permits anywhere in the command. The method is inferred the way cURL itself infers it — any data flag implies POST unless -X says otherwise — which matters because commands copied from a network panel frequently have no explicit method and are not GETs. Cookie, user-agent and referer flags are folded into the headers they actually become. Flags with no equivalent in the target language are not silently dropped: --insecure, --proxy, --output and -F each produce a visible note explaining what was lost, because a converter that quietly discards certificate verification is worse than one that refuses. Output escaping is per language: JavaScript strings are JSON-encoded so a JSON body survives, and Python switches to triple quotes when a value contains both quote styles. Nothing is executed.

Developer Tools

Developer Tools

  • HTTP Status Codes
  • Subnet Calculator
  • IP & MAC Validator
  • URL Parser
  • URL Query Builder
  • Base Encoding Converter
  • Binary Text Converter
  • HTML Entities Encoder