cURL Command Builder

Fill in a method, URL, headers and body, and get a cURL command you can paste straight into a terminal — or the same request as fetch, Axios, Python requests or HTTPie. The thing that makes a generated command actually work is quoting, and it is where most builders fall down: values are wrapped in single quotes here, with the awkward case of a quote inside a value handled properly, so a body containing spaces, quotes or ampersands survives intact. An unquoted ampersand is the nastiest of those, because the shell reads it as 'run this in the background' and the command appears to do nothing at all. The method is only written out when cURL would not already infer it, and long commands are broken across lines so they stay readable. Nothing is ever sent — the command is built, not run.

Characters that break an unquoted command

CharacterWhat the shell does
spaceSplits one argument into two
&Backgrounds the command — it appears to do nothing
'Opens a quote that never closes
$Substitutes a variable, usually empty
`Runs the contents as a command
>Redirects output to a file
|Pipes into another command

When to use it

  1. Write a cURL command for documentation or a bug report.
  2. Turn an API call you are designing into something a colleague can run.
  3. Get the same request in four languages without rewriting it.
  4. Build a request with a JSON body without fighting shell escaping.
  5. Produce a reproducible command for a support ticket.

How to Use

  1. Choose a method and enter the URL.
  2. Add any headers you need.
  3. Paste or type the request body.
  4. Pick an output format and copy it.

Features

  1. Correct single-quote shell escaping, including quotes inside values
  2. Redundant -X omitted, explicit methods kept
  3. Line continuations for readability
  4. fetch, Axios, Python requests and HTTPie output
  5. Per-language escaping, so JSON bodies survive
  6. Basic auth split into the fields each library expects
  7. Nothing executed, nothing uploaded

FAQs

Does it send the request?

No. It only builds the command. Nothing is executed and nothing leaves your browser, so you can safely build a command containing a token you have not rotated yet.

Why does my command break in the terminal elsewhere?

Almost always quoting. An unquoted space splits one argument into two, and an unquoted ampersand makes the shell background the command so it appears to do nothing. Everything here is single-quoted, which protects every character the shell would otherwise act on.

Why is there no -X POST when I chose POST?

Because cURL already sends POST when a body is present, so the flag would be redundant. Any other method is written out explicitly, as is POST without a body.

Can I get the same request as code?

Yes — switch the output to fetch, Axios, Python requests or HTTPie. Each uses its own escaping rules, so a JSON body full of quotes comes out correct in all of them rather than being wrapped in whatever quote character happened to be free.

What about authentication?

Add an Authorization header like any other. When converting a command that used -u, the credentials are split into the separate username and password fields the target library expects, and a password containing a colon is kept whole.

Technical Details

The request is assembled from a form and emitted as a shell command, code, or both — and the part that decides whether the output is usable is quoting. Values are wrapped in single quotes, which protect every character the shell would otherwise interpret, and a single quote inside a value is handled by the standard dance of closing the quoting, emitting an escaped quote and reopening it. Converters that concatenate values without quoting produce commands that look right and break the moment a body contains a space, an ampersand or a dollar sign — the ampersand being the worst, because the shell backgrounds the process and the command appears to do nothing. The method is emitted only when it is not implied: cURL already sends POST when a body is present, so adding -X POST is noise, while any other method needs it explicitly. Long commands are broken across lines with backslash continuations so they stay readable when pasted into a terminal. The same request object also serialises to fetch, Axios, Python requests and HTTPie, where the escaping rules differ again — JavaScript strings are produced with JSON encoding rather than by wrapping in quotes, so a JSON body full of double quotes survives, and Python uses triple quotes when a value contains both quote styles. Basic credentials are split into the separate username and password fields those libraries expect rather than being left as a single colon-joined string, and a password containing a colon is kept whole by splitting only on the first one. Nothing is sent: the command is built, never executed.

Developer Tools

Developer Tools

  • cURL to Code
  • HTTP Status Codes
  • Subnet Calculator
  • IP & MAC Validator
  • URL Parser
  • URL Query Builder
  • Base Encoding Converter
  • Binary Text Converter