OneWebDesk

cURL Command Builder

Build a runnable cURL command from method, headers and body.

Enter an HTTP method, URL, headers and request body, and this tool builds a ready-to-run curlcommand for you. You no longer need to memorise quote escaping or the order of -X,-H and --data options — the command updates as you type, ready to copy straight into your terminal.

It is handy for debugging APIs, testing REST endpoints, or attaching a reproducible request to docs and issues. Everything runs entirely in your browser, so the URL, tokens and body you enter are never sent to any server — you can safely build requests that include authentication headers.

Enter a URL and a runnable curl command will appear here.

How the command is assembled

The tool composes your input in the following order. For readability each option is split onto its own line with a trailing backslash (\), but the command works identically pasted as a single line.

  • Method: added as -X POST whenever it is not GET.
  • URL: wrapped in single quotes to stop the shell from interpreting special characters.
  • Headers: each key/value pair becomes -H 'Content-Type: application/json'.
  • Body: appended via --data when the method is not GET/HEAD and the body is non-empty.

Quoting and escaping

In a shell, text inside single quotes is passed through literally with no variable substitution or escaping, which makes it the safest wrapper. The catch is that a single quote inside the value would terminate the string, so this tool converts each inner single quote into the '\'' pattern to embed the quote safely. Values full of double quotes, such as JSON bodies, can be pasted as-is.

Practical tips

  1. For authenticated APIs, add an Authorization header row in the form Bearer <token>.
  2. When sending JSON, also add a Content-Type: application/json header so the server parses it correctly.
  3. To inspect only response headers, switch the method to HEAD and the body field disappears automatically.

Going the other way, when you need to dissect a long command someone sent you, the cURL command parser breaks the method, URL, headers and body back out into tables.

Frequently asked questions

Are the tokens or URLs I enter sent anywhere?
No. The command is assembled entirely in your browser; nothing you type is transmitted to or stored on any server, so requests with authentication headers are safe to build here.
What happens if a value contains a single quote?
Inner single quotes are escaped automatically so the command stays valid in the shell. You can paste values that contain quotes without breaking the output.
Can I paste the multi-line command as a single line?
Yes. The trailing backslashes are just shell line-continuation characters for readability. Remove the backslashes and newlines and the one-line command runs the same way.
Does it work in Windows cmd or PowerShell?
The generated command targets POSIX shells like bash/zsh. PowerShell has similar single-quote rules but uses a backtick for line continuation, and cmd handles quoting differently, so minor edits may be needed.
Can I attach a body to a GET request?
The tool hides the body field for GET and HEAD, since GET bodies are discouraged and ignored by many servers. Choose POST or another method if you need to send a body.

Related tools

HTTP / API