cURL command builder
Fill in a request and get a clean, correctly quoted curl command with the right flags.
Build a curl command without remembering the flags
curl is the universal way to show how to call an API: in documentation, bug reports, runbooks and chat messages. Writing one by hand means remembering which flag sends JSON, how to quote a body that contains quotes, and how to keep credentials out of sight. This builder turns a short form into a correct command, with the quoting handled and warnings for the usual mistakes.
Enter the method, URL, headers and body. Choose the body type: JSON (a Content-Type header is added unless you gave one, and the JSON is checked), raw text, application/x-www-form-urlencoded pairs, or multipart form fields with file uploads (file=@photo.png). Add Bearer or basic authentication, follow redirects, set a timeout or ask for compressed responses. The command is written one option per line with trailing backslashes so it stays readable, and a Windows cmd version is provided too.
Habits for safer commands
- Put tokens in an environment variable and reference it (
"Authorization: Bearer $TOKEN") so they do not end up in shell history or documentation. - Avoid
-kexcept for local testing: it disables certificate verification. - Use
--fail-with-bodyor--failin scripts so HTTP errors give a non-zero exit code. - Quote URLs that contain
&or?; the builder does this for you.
To go the other way, paste a command into the cURL converter. Everything runs locally in your browser.
Frequently asked questions
Why does the command use --data-raw?
-d treats a leading @ as a file name and strips newlines, which can silently change a JSON body. --data-raw sends the text exactly as written, so it is the safer choice for JSON.
How are quotes in the body handled?
The command is quoted for POSIX shells (bash, zsh): the text is wrapped in single quotes and any single quote inside is written as '\''. The Windows tab uses double quotes for cmd.exe.
What is the difference between -F and --data-urlencode?
-F sends multipart/form-data, which is how file uploads work. --data-urlencode sends application/x-www-form-urlencoded and percent-encodes the values.
Can I convert the command to Java?
Yes. Use the cURL converter on this site to turn a command into Java HttpClient, Spring WebClient, RestTemplate, OkHttp, JavaScript, Python or Go.