Build a correct curl command without memorizing flags: pick the method, enter the URL, add query parameters, headers, a JSON, form, multipart or file body, authentication and options. The command updates as you type, is quoted correctly for Bash, Windows CMD or PowerShell, and comes with a preview of the raw HTTP request.
Last updated:
Start from:
Values are URL-encoded for you. Query strings typed into the URL are moved here automatically.
For a file field, choose File and enter the local path as it should appear in the command (for example ./photo.jpg).
Sent byte-for-byte with --data-binary @file. Use PUT with -T file by ticking "Upload with -T" in Options.
Your curl command
HTTP request preview
The command is built locally in your browser. Nothing is sent: this page never contacts the URL you enter.
Advertisement
Advertisement
How to use the cURL Command Builder
Choose a starting point such as GET JSON API, POST JSON or Upload a file, or start blank.
Set the method and URL, then add query parameters and headers in their tabs.
Add a body on the Body tab: JSON, a form, multipart fields and files, raw text or a binary file.
Set authentication and options like follow redirects, timeouts, retries or an output file.
Pick your shell (Bash, CMD or PowerShell), review any warnings, then press Copy command and paste it in your terminal.
Common curl options at a glance
Short
Long
What it does
-X
--request
Sets the HTTP method (PUT, PATCH, DELETE…)
-H
--header
Adds a request header; -H 'Name;' sends it with an empty value
-d
--data
Sends a form-encoded body and switches to POST
--json
Sends JSON with the right Content-Type and Accept headers (curl 7.82+)
-F
--form
Multipart field; name=@file uploads a file
-u
--user
Basic auth credentials as user:password
-L
--location
Follows 3xx redirects
-i
--include
Prints response headers before the body
-I
--head
Sends a HEAD request and shows headers only
-o
--output
Saves the response to a file
-f
--fail
Exits with an error (code 22) on HTTP 400 and above, useful in scripts
-sS
--silent --show-error
Hides the progress meter but still prints errors
-m
--max-time
Gives up after this many seconds in total
-w
--write-out
Prints variables such as %{http_code} or %{time_total} after the transfer
Quoting rules by shell
Bash and zsh: single quotes keep everything literal, so JSON can be pasted as is. A single quote inside the value is written as '\''. Variables like $API_TOKEN only expand inside double quotes.
Windows CMD: only double quotes work, and inner double quotes become \". Use ^ at the end of a line to continue the command. Long JSON bodies are easier to keep in a file: -d @body.json.
PowerShell: call curl.exe, not curl. Single quotes are literal (a quote inside is doubled), a backtick continues the line, and $env:NAME reads an environment variable. Before PowerShell 7.3, embedded double quotes must also be escaped as \".
Need the same request in Python, JavaScript or PHP? Paste the finished command into the cURL to Code Converter.
Frequently asked questions
How do I send JSON with curl?
Set the Content-Type header and pass the body with --data-raw (or -d): curl -H 'Content-Type: application/json' --data-raw '{"name":"Ada"}' https://api.example.com/users. Since curl 7.82 you can use --json '{...}', which also sets Accept: application/json and uses POST automatically.
Why is there no -X POST in my command?
curl switches to POST by itself when you pass -d, --data-raw, --data-urlencode or -F, so -X POST is redundant. Adding -X POST is harmless, but combining -X with -L can keep the wrong method after a redirect, so the builder only adds -X when it changes something.
What is the difference between -d, --data-raw, --data-urlencode and -F?
-d sends data as application/x-www-form-urlencoded and treats a leading @ as a file name. --data-raw is the same but never reads files. --data-urlencode encodes the value for you. -F sends multipart/form-data, which is needed to upload files with name=@path.
Why does my curl command fail in PowerShell?
In Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest, so you must call curl.exe. PowerShell versions before 7.3 also strip double quotes from arguments passed to programs, so JSON needs \" escapes. Pick the right PowerShell option and the builder handles both.
How do I upload a file with curl?
For an HTML-style form upload use multipart: curl -F 'file=@./photo.jpg' -F 'title=Holiday' https://example.com/upload. To send the file as the raw request body use --data-binary @file with a Content-Type header, or -T file for a PUT upload.
Is it safe to put tokens in a curl command?
It works, but the command, including the token, is saved in your shell history and may appear in process lists. Tick Use environment variables to reference $API_TOKEN, $API_PASSWORD or $API_KEY instead, and set them in your session first.
Does this tool send the request?
No. It only builds the command text in your browser and never contacts the URL. Run the command in your own terminal, or use an API request tester if you want to send it from the browser.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.