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.
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 POSTwhenever it is notGET. - 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
--datawhen the method is notGET/HEADand 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
- For authenticated APIs, add an
Authorizationheader row in the formBearer <token>. - When sending JSON, also add a
Content-Type: application/jsonheader so the server parses it correctly. - To inspect only response headers, switch the method to
HEADand 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.
Handy curl flags quick reference
This tool emits -X, -H and --data only, but real debugging usually means tacking on a few more flags by hand. Append any of these to the end of the generated command.
| Flag | What it does | When to use it |
|---|---|---|
-i | Print response headers together with the body | Checking the status code and cache headers at a glance |
-v | Verbose: request/response headers plus the TLS handshake | Tracking down redirect or auth failures |
-L | Follow 301/302 redirects automatically | When you need the response of the final URL |
-s | Silent — hide the progress meter | Piping or post-processing the output in a script |
-o file | Save the response body to a file | Downloading binary or large responses |
-w '%{http_code}' | Print only metrics like status code and timing | Automating health checks and latency measurements |
A worked example
Enter method POST, URL https://api.example.com/v1/login, header Content-Type: application/json and body {"id":"alice","pw":"p'wd"}, and the tool produces:
curl -X POST 'https://api.example.com/v1/login' \
-H 'Content-Type: application/json' \
--data '{"id":"alice","pw":"p'\''wd"}'Notice how the single quote inside the password (p'wd) became p'\''wd. That is three pieces — close the current string ('), an escaped quote (\'), then reopen the string (') — which the shell concatenates into one word, leaving a single literal quote inside the value.
Common pitfall
- Sending a JSON body but forgetting the
Content-Type: application/jsonheader: curl defaults toapplication/x-www-form-urlencoded, and many servers respond with400. --data(alias-d) strips newlines from the body. To send newlines verbatim, switch to--data-binaryby hand.- A query string containing
&pasted without quotes makes the shell run the command in the background — which is exactly why this tool always wraps the URL in single quotes.
Frequently asked questions
Are the tokens or URLs I enter sent anywhere?
What happens if a value contains a single quote?
Can I paste the multi-line command as a single line?
Does it work in Windows cmd or PowerShell?
Can I attach a body to a GET request?
Related guides
- Fixing CORS Errors: Access-Control-Allow-Origin ExplainedWhy the browser throws CORS errors and how to fix each case — preflight, credentials and the wildcard trap.