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.
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 METHOD` to 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 `Authorization` or 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-Type` header 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-Type` headers.
- 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-timeout` and `--max-time` so a hung endpoint can't block the build, and check status codes with `-w`.
- File Upload & Download
- Assemble a `multipart/form-data` upload with `-F field=@file`, or build a `-L -o filename` download 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-Type` headers. 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 `-u` appear, add a JSON body and watch the `Content-Type` header 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). On `cmd.exe` switch to double quotes; Git Bash and WSL run the generated single-quote commands unchanged.
- -d vs --data-raw vs --data-binary
- `-d`/`--data` strips newlines and carriage returns from the body — fine for `key=value` pairs, lossy for multi-line content. `--data-raw` is the same but won't treat a leading `@` as a filename. `--data-binary` sends bytes exactly as given (use `@file` to upload raw file contents). All three imply POST unless the method is overridden.
- Multipart (-F) vs URL-encoded (-d)
- `-F field=value` produces `multipart/form-data` with a generated boundary — required for file uploads (`-F file=@path`) and mixed file/text forms. `-d field=value` produces `application/x-www-form-urlencoded`, a single `&`-joined string. Never set `Content-Type` manually for multipart; curl computes the boundary and sets the header itself.
- Auth Header Encoding
- Bearer auth sends `Authorization: Bearer
` verbatim (RFC 6750). Basic auth from `-u user:pass` is Base64-encoded into `Authorization: Basic ` over the wire — encoding, not encryption, so use HTTPS. An API key is whatever custom header the service requires, e.g. `X-API-Key: `. - 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-urlencode` handles encoding at request time.
- Redirect Behavior (-L)
- Without `-L`, curl prints a 301/302 response and stops. With `-L` it follows the `Location` header to the final URL. Note that curl drops the `Authorization` header when a redirect crosses to a different host (a security default); use `--location-trusted` only when you understand the implications.
- Compressed Responses
- `--compressed` adds an `Accept-Encoding` header 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 filename` writes the response body to a file you name; `-O` saves it under the remote filename from the URL path. Both suppress the normal stdout dump. Combine with `-L` so 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 @headerfile` so 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 @file` rather than `-d @file`. Plain `-d` strips newlines and carriage returns, silently corrupting binary and multi-line content. `--data-binary` sends the file exactly as it is on disk.
- Quote Header Values
- Always wrap `-H` values 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 `--compressed` on 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-timeout` and `--max-time` so a slow or hung endpoint can't block a pipeline forever. A health check with `--max-time 10` fails fast and lets your CI move on. Pair with `--retry N` to 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 `-v` to see the exact request line, headers, and TLS handshake. It's the fastest way to catch a wrong method, a missing `Content-Type`, or an auth header that didn't get attached — debug interactively, then remove `-v` for production.
Frequently Asked Questions
What does this tool do?
Is my data (tokens, URLs) uploaded anywhere?
How do I send a POST request with JSON in curl?
How do I add a Bearer token to a curl request?
How do I upload a file with curl?
Can I import a command copied from browser DevTools ("Copy as cURL")?
How is curl on Windows different?
What's the difference between -d, --data-raw, and --data-binary?
How do I send cookies with curl?
How do I follow redirects?
How do I set a request timeout?
Related Tools
View all tools →Number Base Converter — Binary, Hex, Decimal & Octal
Conversion Tools
Convert between binary, hex, decimal, octal and any base (2-36) instantly. Free, private — all processing in your browser.
Base64 Decoder & Encoder
Encoding & Formatting
Decode and encode Base64 online for free. Real-time conversion with full UTF-8 and emoji support. 100% private — runs in your browser. No signup needed.
Case Converter — UPPERCASE, lowercase, camelCase & More
Text Processing
Convert text between UPPERCASE, lowercase, Title Case, Sentence case, camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE and 6 more formats instantly. Free, browser-only, no signup.
Color Converter — HEX, RGB, HSL & OKLCH
Conversion Tools
Convert HEX to RGB, HSL, OKLCH, OKLAB and CMYK in your browser — copy any format with one click. Free, no signup, your colors never leave the page.
Crontab Generator & Cron Expression Builder
Date & Time
Build, validate, and decode cron expressions in your browser. Live next-run preview in local time or UTC. POSIX 5-field syntax, presets, plain-English description. Free, private, no signup.
CSV to JSON Converter
Encoding & Formatting
Convert CSV to JSON in your browser. RFC 4180, type inference, header row, big-int safe. 100% private, no upload.