cURL Command Generator & Builder
Build curl commands in your browser — set method, headers, auth, and body, get a copy-ready command instantly. Presets for Bearer, POST JSON, file upload. Free, private, no signup.
Our team verifies the curl command builder against real curl behavior across HTTP methods (GET/POST/PUT/PATCH/DELETE), authentication schemes (Bearer, Basic, API-key headers), body types (raw JSON, urlencoded form, multipart file upload), and option flags (-L, -k, -v, -i, --compressed, -o, timeouts, proxy) — with shell-safe single-quote escaping and correct query-string encoding.
What Is a curl Command?
curl is a command-line tool for transferring data over HTTP and dozens of other protocols. A curl command is the binary name, a set of flags, and a URL — for example curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{"name":"Ada"}'. Because curl ships on virtually every Linux, macOS, and modern Windows machine, it's the universal way to test an API, reproduce a request from documentation, or health-check a service from inside a CI script. The terseness that makes it powerful also makes it hard to remember, which is exactly why a visual builder helps.
Every curl command has the same anatomy. The method (-X GET, -X POST, …) sets the HTTP verb, defaulting to GET. The URL is the endpoint, with query parameters appended after a ?. Headers (-H 'Key: Value', repeatable) carry metadata like Accept and Content-Type. Authentication is just a special header — -H 'Authorization: Bearer …' for a token, -u user:pass for Basic auth, or a custom -H 'X-API-Key: …'. The body (-d for raw or form data, -F for multipart and file uploads) carries the payload. Finally, option flags like -L (follow redirects), -i (include response headers), and -v (verbose) shape the behavior. This tool lays out each of those parts as a form field and rebuilds the command live.
Reach for a curl command generator when you'd otherwise be fumbling with quoting, forgetting the Content-Type header on a JSON POST, or hand-assembling a multipart upload. The builder gets the shell-safe single-quote escaping right, encodes your query string, and attaches the correct headers for each body type — then you copy a command you can trust. For an exhaustive flag-by-flag reference with 40+ runnable examples, read the companion curl cheat sheet; to encode tricky query-string values you can use our URL encoder.
Everything happens in your browser. Your tokens, credentials, URLs, and request bodies are assembled with client-side JavaScript and never sent anywhere — so you can build commands against real production endpoints with real API keys and nothing leaves your device.
# Plain GET — curl defaults to GET
curl https://api.example.com/users
# GET with a Bearer token (auth is just a header)
curl https://api.example.com/me \
-H 'Authorization: Bearer YOUR_TOKEN'
# POST a JSON body — note the Content-Type header
curl -X POST https://api.example.com/users \
-H 'Content-Type: application/json' \
-d '{"name":"Ada","role":"admin"}'
# Multipart file upload — '@' reads the file from disk
curl -X POST https://api.example.com/upload \
-F 'file=@report.pdf' \
-F 'title=Q3 report' Key Features
Visual Request Builder
Lay out the whole request as form fields — method, URL, query parameters, headers, auth, body, and options — instead of memorizing flag order and quoting. No more guessing whether the URL goes before or after the -d.
Live Command with Copy & Export
The curl command rebuilds on every keystroke at the bottom of the page. Copy it to your clipboard in one click, or Export .sh to download a runnable shell script you can drop straight into a repo or CI job.
Full Authentication Support
Bearer token, Basic auth (-u user:pass), and custom API-key headers, each emitted in the exact format servers expect. Pick the scheme, paste the credential, and the right Authorization or custom header is generated for you.
Every Body Type
Raw JSON (with the matching Content-Type header added automatically), application/x-www-form-urlencoded form fields, and multipart/form-data uploads where any field can be toggled to a file with the @ prefix.
Six One-Click Presets
GET with Bearer, POST JSON, Form upload, Basic auth, Download -o, and Verbose debug fill the entire form in one tap. Start from a working request for the most common API tasks and tweak from there.
Multi-line & Single-line Output
Toggle between a compact single-line command for quick paste and a backslash-continued multi-line version that's easy to read in a script or review in a pull request. Same command, two shapes.
100% Browser-Based Privacy
Tokens, URLs, headers, and request bodies are assembled entirely client-side and never leave your device — verify it in the Network tab. Safe for production endpoints and live credentials with zero data exposure.
Built for the DevTools Workflow
Designed around the everyday loop of testing APIs and reproducing requests from browser DevTools "Copy as cURL". A Convert tab that parses a pasted curl command into fetch, requests, Go, PHP, Ruby, and Node.js ships in the next release.
curl Alternatives & HTTP Clients
HTTPie
CLI, human-friendly syntaxA modern CLI with colorized output and a terser syntax (http POST api.example.com/users name=Ada). Sets JSON Content-Type by default. Friendlier for interactive use; curl wins on ubiquity and scripting portability.
wget
CLI, download-focusedBest for recursive downloads and mirroring sites; follows redirects and retries by default. Weaker than curl for arbitrary methods, custom headers, and API testing. Often pre-installed alongside curl on Linux.
Postman
GUI appA full GUI for building, saving, and sharing requests with collections, environments, and team sync. Great for exploratory API work; can import/export curl. Heavier than a one-line command for quick checks or CI.
Insomnia
GUI appA lighter open-source alternative to Postman with a clean request builder and curl import/export. Good for organizing API requests; like Postman, more than you need for a single scripted call.
fetch() / requests
In-code HTTP clientsJavaScript fetch() and Python requests are how you make the call from application code. Build and verify the request as curl first, then translate — the upcoming Convert tab will generate the equivalent fetch, requests, and other client code.
curl Command Examples
Plain GET Request
curl https://api.example.com/users
With no method flag, curl defaults to GET. This is the simplest possible request — fetch a resource and print the response body to your terminal. Add query parameters in the builder and they're URL-encoded onto the end automatically (?page=2&limit=50).
GET with Bearer Token
curl https://api.example.com/me \ -H 'Authorization: Bearer YOUR_TOKEN'
The most common authenticated call against a REST API. The Bearer auth preset adds the Authorization: Bearer … header for you. To inspect what's inside a JWT before you send it, paste the token into our JWT decoder.
POST JSON Body
curl -X POST https://api.example.com/users \
-H 'Content-Type: application/json' \
-d '{"name":"Ada","role":"admin"}' A curl POST request generator staple: the JSON body type sets -X POST, attaches the Content-Type: application/json header, and passes the payload with -d. Format messy API responses afterward with our JSON formatter.
POST Form (urlencoded)
curl -X POST https://api.example.com/login \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'username=ada&password=s3cret'
Classic HTML-form submission. Each -d field=value pair is joined with & and sent as application/x-www-form-urlencoded. curl URL-encodes reserved characters; build the fields in the form body section and the tool assembles the string for you.
Multipart File Upload
curl -X POST https://api.example.com/upload \ -F 'file=@report.pdf' \ -F 'title=Q3 report'
The curl file upload command uses -F for multipart/form-data. Prefix a value with @ to attach a file from disk; mix file and text fields freely. curl sets the multipart boundary and Content-Type automatically — never set it by hand.
Download to a File
curl -L -o archive.zip \ https://example.com/files/archive.zip
Save the response body to a named file with -o, and -L follows any redirects to the real download URL (common with CDN and release-asset links). Use -O instead of -o to keep the server's filename.
Basic Authentication
curl -u ada:s3cret \ https://api.example.com/private
curl basic auth uses -u user:pass; curl Base64-encodes the credentials into an Authorization: Basic … header over the wire. Always send Basic auth over HTTPS — Base64 is encoding, not encryption, and is trivially reversible.
Verbose Debug
curl -v -i https://api.example.com/health
When a request misbehaves, -v prints the full request line, every header sent and received, and the TLS handshake; -i includes the response headers in the body output. The first thing to reach for when an API returns the wrong status code.
How to Build a curl Command
- 1
Choose the HTTP method
Select GET, POST, PUT, PATCH, DELETE, HEAD, or OPTIONS. curl defaults to GET; picking POST or another verb adds
-X METHODto the generated command. Or tap a preset chip to set the method and a matching body in one click. - 2
Enter the URL and query parameters
Type the request URL (e.g.
https://api.example.com/users). Add query parameters as key/value pairs and the tool URL-encodes them and appends?key=value&…to the URL automatically — no manual encoding needed. - 3
Add headers and authentication
Add request headers as key/value pairs, then choose an auth scheme: None, Bearer token, Basic (username/password), or a custom API-key header. The correct
Authorizationor custom header is generated in the exact format the server expects. - 4
Set the request body
For POST/PUT/PATCH, choose a body type: paste raw JSON (the
Content-Typeheader is added for you), build urlencoded form fields, or assemble a multipart upload and toggle any field to a file with the@prefix. - 5
Toggle options
Flip on the flags you need — follow redirects (
-L), insecure TLS (-k), verbose (-v), include headers (-i), compressed (--compressed), output to file (-o), a connect timeout, or a proxy (-x). Each toggle updates the command live. - 6
Copy, export, or reset
Copy the finished command, Export .sh to download it as a script, or Reset to clear the form. Use the Multi-line toggle to switch between single-line and backslash-continued output before you copy.
Common curl Mistakes
Missing -X With a Method That Has a Body
Sending a body with -d implies POST, but if you need PUT or PATCH you must say so explicitly with -X. Forgetting it sends the body as a POST and the server returns the wrong status or rejects the request.
# Intended a PATCH, but -d alone implies POST
curl -d '{"role":"admin"}' \
https://api.example.com/users/7 # Set the verb explicitly
curl -X PATCH -d '{"role":"admin"}' \
-H 'Content-Type: application/json' \
https://api.example.com/users/7 Missing Content-Type on a JSON POST
Sending JSON with -d does NOT set the Content-Type header — curl defaults to application/x-www-form-urlencoded. Most APIs then fail to parse the body and return a 400 or 415. Always attach the JSON content type (or use the JSON body preset, which adds it for you).
# Server sees urlencoded, not JSON — 400/415
curl -X POST https://api.example.com/users \
-d '{"name":"Ada"}' # Declare the JSON content type
curl -X POST https://api.example.com/users \
-H 'Content-Type: application/json' \
-d '{"name":"Ada"}' Single vs Double Quote Escaping
Inside double quotes the shell expands $, backticks, and !, mangling JSON or breaking on a $variable inside your payload. Single quotes pass the body through literally. Use single quotes for JSON bodies; switch to double quotes only on cmd.exe, which doesn't honor single quotes.
# $name gets expanded by the shell to empty string
curl -d "{\"user\":\"$name\"}" \
https://api.example.com/users # Single quotes send the body literally
curl -d '{"user":"$name"}' \
https://api.example.com/users Using -d on a GET Request
Adding -d to a request silently turns it into a POST. If you wanted a GET with query parameters, put them in the URL (or use -G to fold the -d data onto the query string). A -d on a GET is one of the most common reasons "my GET isn't working".
# -d makes this a POST, not a GET curl -d 'page=2&limit=50' \ https://api.example.com/users
# Query string on the URL keeps it a GET curl 'https://api.example.com/users?page=2&limit=50'
Windows Line Continuation: ^ vs \
The backslash (\) continues a command onto the next line in bash, Git Bash, and WSL. In cmd.exe the continuation character is the caret (^), and PowerShell uses a backtick (`` ` ``). Pasting a backslash-continued command into cmd breaks it — switch this tool to single-line output for Windows cmd.
:: cmd.exe — backslash is not a continuation char
curl -X POST https://api.example.com/users \
-d '{"name":"Ada"}' :: cmd.exe — one line, or use ^ to continue
curl -X POST https://api.example.com/users -d "{\"name\":\"Ada\"}" Spaces in the URL Not Encoded
A raw space (or &, #, ?) in a URL or query value breaks the command — the shell splits the argument and curl sees a truncated URL. Percent-encode the value (a space becomes %20) or let curl encode it with --data-urlencode. The query-parameter fields in this tool encode automatically.
# Space splits the argument — curl sees two args curl https://api.example.com/search?q=hello world
# Encode the space (or quote the whole URL) curl 'https://api.example.com/search?q=hello%20world'
Common Use Cases
- REST API Testing
- Build and fire requests against a REST endpoint without leaving the terminal: set the method, paste a Bearer token, send a JSON body, and read the response. The fastest way to confirm an API behaves before writing client code.
- Reproducing a Request from Docs
- API documentation shows endpoints and parameters but rarely a complete, copy-ready command. Fill in the method, URL, headers, and auth here and get a curl command that runs as-is — no fighting with quoting or missing
Content-Typeheaders. - CI/CD Smoke-Test Scripts
- Generate a curl command for a health check or post-deploy smoke test, then Export .sh to drop it into a pipeline. Add
--connect-timeoutand--max-timeso a hung endpoint can't block the build, and check status codes with-w. - File Upload & Download
- Assemble a
multipart/form-dataupload with-F field=@file, or build a-L -o filenamedownload that follows redirects to a CDN. Encode any tricky filenames or query values first with our URL encoder. - Webhook Debugging
- Replay a webhook payload by POSTing the same JSON body the provider sends, with the right signature and
Content-Typeheaders. Reproduce the exact request locally to debug why your handler rejected it. - Reproducible Bug Reports
- Paste a single self-contained curl command into a bug report or PR so anyone can reproduce the exact request — method, headers, auth placeholder, and body. Far clearer than describing the request in prose.
- Learning curl Flags
- See how each form choice maps to a real flag — pick Basic auth and watch
-uappear, add a JSON body and watch theContent-Typeheader attach. A hands-on way to learn the syntax, paired with our curl cheat sheet. - Prepping a Request to Convert to Code
- Build and verify the request as curl first, then translate it to your app's HTTP client. The upcoming Convert tab will turn a pasted curl command into fetch, requests, Go, PHP, Ruby, and Node.js — start from a curl command you know works.
curl Flags & Syntax Reference
- Shell Quoting & Escaping
- The tool wraps values in single quotes, the safest form in POSIX shells because nothing inside a single-quoted string is expanded. A literal single quote inside a value is emitted as the
'\''sequence (close-quote, escaped quote, reopen-quote). Oncmd.exeswitch to double quotes; Git Bash and WSL run the generated single-quote commands unchanged. - -d vs --data-raw vs --data-binary
-d/--datastrips newlines and carriage returns from the body — fine forkey=valuepairs, lossy for multi-line content.--data-rawis the same but won't treat a leading@as a filename.--data-binarysends bytes exactly as given (use@fileto upload raw file contents). All three imply POST unless the method is overridden.- Multipart (-F) vs URL-encoded (-d)
-F field=valueproducesmultipart/form-datawith a generated boundary — required for file uploads (-F file=@path) and mixed file/text forms.-d field=valueproducesapplication/x-www-form-urlencoded, a single&-joined string. Never setContent-Typemanually for multipart; curl computes the boundary and sets the header itself.- Auth Header Encoding
- Bearer auth sends
Authorization: Bearer <token>verbatim (RFC 6750). Basic auth from-u user:passis Base64-encoded intoAuthorization: Basic <base64>over the wire — encoding, not encryption, so use HTTPS. An API key is whatever custom header the service requires, e.g.X-API-Key: <value>. - Query-String Encoding
- Query parameters added in the builder are percent-encoded and appended as
?key=value&key2=value2. Reserved characters (spaces,&,=,#) are escaped so the URL is valid. For body fields that must be encoded, curl's own--data-urlencodehandles encoding at request time. - Redirect Behavior (-L)
- Without
-L, curl prints a 301/302 response and stops. With-Lit follows theLocationheader to the final URL. Note that curl drops theAuthorizationheader when a redirect crosses to a different host (a security default); use--location-trustedonly when you understand the implications. - Compressed Responses
--compressedadds anAccept-Encodingheader advertising gzip/deflate/brotli support and transparently decompresses the response, saving bandwidth. The decoded body is identical to an uncompressed request — purely a transfer optimization, safe to enable on most API calls.- Output: -o vs -O
-o filenamewrites the response body to a file you name;-Osaves it under the remote filename from the URL path. Both suppress the normal stdout dump. Combine with-Lso redirects resolve to the real asset before the file is written.
Best Practices for curl Requests
- Never Hard-Code Secrets in Shared Commands
- A curl command you paste into a PR, a ticket, or a chat will be read by others and indexed by tools. Replace tokens and passwords with a placeholder (
YOUR_TOKEN) or reference an environment variable (-H "Authorization: Bearer $API_TOKEN"). For long credentials, curl can read a header from a file with-H @headerfileso the secret never appears in shell history. - Prefer --data-binary @file for Binary Payloads
- When the body is a file whose bytes matter — an image, a signed payload, JSON where whitespace is significant — use
--data-binary @filerather than-d @file. Plain-dstrips newlines and carriage returns, silently corrupting binary and multi-line content.--data-binarysends the file exactly as it is on disk. - Quote Header Values
- Always wrap
-Hvalues in quotes:-H 'Content-Type: application/json'. Unquoted, the space after the colon splits the argument and curl sees a malformed header. Single quotes also stop the shell from expanding$,*, and other special characters inside the value — exactly what this tool emits by default. - Use --compressed to Save Bandwidth
- Add
--compressedon API calls and downloads to request gzip/brotli encoding and have curl decompress transparently. For JSON-heavy APIs this can cut transfer size by 70–90% with no change to the response you see — a free win in scripts that poll endpoints repeatedly. - Pin Timeouts in Scripts
- In any automated context, add
--connect-timeoutand--max-timeso a slow or hung endpoint can't block a pipeline forever. A health check with--max-time 10fails fast and lets your CI move on. Pair with--retry Nto absorb transient network blips without giving up immediately. - Verify with -v Before Automating
- Before baking a curl command into a script or cron job, run it once with
-vto see the exact request line, headers, and TLS handshake. It's the fastest way to catch a wrong method, a missingContent-Type, or an auth header that didn't get attached — debug interactively, then remove-vfor production.
Frequently Asked Questions
What does this tool do?
.sh script, or switch between single-line and multi-line output. It's a curl command generator built for the everyday workflow of testing a REST API, reproducing a request from documentation, or dropping a reproducible command into a bug report. For a deeper reference on the flags themselves, see our curl cheat sheet. Is my data (tokens, URLs) uploaded anywhere?
How do I send a POST request with JSON in curl?
curl -X POST <url> -H 'Content-Type: application/json' -d '{…}'. Two parts matter: the -d (or --data) flag carries the body, and the Content-Type: application/json header tells the server how to parse it — omit the header and many frameworks ignore or misread the payload. Modern curl (7.82+) also offers a --json shortcut that sets the header and body together. After the call, paste the response into our JSON formatter to pretty-print and validate it. How do I add a Bearer token to a curl request?
Authorization header with the value Bearer YOUR_TOKEN, or pick the "GET with Bearer" preset and paste your token. The generated command is curl <url> -H 'Authorization: Bearer YOUR_TOKEN'. The word Bearer, a single space, then the token — that exact format is required by the OAuth 2.0 Bearer spec (RFC 6750). To inspect a token's claims and expiry before sending it, decode it with our JWT decoder. How do I upload a file with curl?
curl -X POST <url> -F 'file=@/path/to/file'. The @ prefix tells curl to read the file from disk and send it as multipart/form-data; you can add more -F fields for both files and plain text values in the same request. Don't set the Content-Type header yourself for multipart — curl generates the boundary and sets the header automatically, and overriding it breaks the upload. For a single-file PUT instead, curl uses -T file <url>. Can I import a command copied from browser DevTools ("Copy as cURL")?
-H header into the headers section and the URL into the URL field. How is curl on Windows different?
cmd.exe you use double quotes (") around values and the caret (^) for line continuation, and single quotes have no special meaning. In PowerShell, curl is an alias for Invoke-WebRequest unless you call curl.exe explicitly, and quoting rules differ again. The most painless option is Git Bash or WSL, where the Unix-style single-quote commands this tool generates run unchanged. If you must use cmd, switch the generated command to single-line and replace the '…' quoting with "…". What's the difference between -d, --data-raw, and --data-binary?
-d (alias --data) sends a body and strips newlines and carriage returns from the data — fine for key=value form pairs, risky for JSON that spans lines. --data-raw is identical but does not treat a leading @ as a filename, so it's the safe choice when your data could literally start with @. --data-binary sends the bytes exactly as given with no newline stripping at all — the correct flag for uploading a file's raw contents (--data-binary @file.json) or any payload where whitespace is significant. All three imply POST unless you override the method. How do I send cookies with curl?
-b to send cookies and -c to save them. -b 'name=value' sends a literal cookie string, while -b cookies.txt reads cookies from a Netscape-format file. To capture cookies a server sets (for example after a login), add -c cookies.txt to write them to a jar, then reuse that jar with -b cookies.txt on the next request. This builder focuses on headers, auth, and body; for a cookie header you can also just add a Cookie: name=value header in the headers section. How do I follow redirects?
-L flag manually. By default curl prints the 301/302 response and stops; -L tells it to follow the Location header to the final destination. This is essential for download links behind CDNs, shortened URLs, and APIs that redirect HTTP to HTTPS. Combine it with -o filename to save a downloaded file after the redirect resolves. How do I set a request timeout?
--connect-timeout <seconds>, which caps how long curl waits to establish the connection. For a ceiling on the entire transfer — connection plus download — add --max-time <seconds> to the generated command manually. Pinning timeouts is a best practice in any script or CI smoke test: without them a hung endpoint can block your pipeline indefinitely. Pair with --retry N if you want curl to retry transient failures. Related Tools
View all tools →htpasswd Generator — bcrypt, Apache MD5 (apr1) & Basic Auth
Web & API
Generate htpasswd entries with bcrypt, Apache MD5 (apr1), SHA-1 & more. Get ready-to-paste Apache, nginx & Docker config. 100% in your browser — no upload.
Open Graph & Meta Tag Generator
Web & API
Generate Open Graph, Twitter Card & SEO meta tags with a live Google, Facebook & X preview. 100% free, in-browser, no signup — copy & paste the code.
Nginx Location Tester — Why That Block Wins
Web & API
See which nginx location block wins — and why every other block lost. Free location match tester for =, ^~, ~ and ~*, running entirely in your browser.
IPv4 Subnet Calculator
Web & API
Free IPv4 subnet calculator: enter 192.168.1.130/26 for the network address, broadcast, usable host range, netmask and wildcard, plus paste-ready Cisco and Linux config.
traceparent Decoder — W3C Trace Context
Web & API
Stop counting hex digits. Free online traceparent decoder — runs in your browser, nothing uploaded. Trace ID, span ID, all 8 trace-flags bits, tracestate check, Datadog/X-Ray/B3 conversion.
AES Decryption Tool — OpenSSL & CryptoJS Compatible
Security Tools
Decrypt AES online — GCM/CBC/CTR, passphrase or raw key, auto-detects OpenSSL & CryptoJS "U2FsdGVkX1" format. 100% in-browser, keys never leave the page.