Skip to content

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.

No Tracking Runs in Browser Free
Your command is built entirely in your browser. Tokens, URLs, and payloads never leave your device.
Presets
Query parameters
Headers
Authentication
Request body
Options
Generated command
Reviewed for correct curl command generation across methods, auth, and body types, accurate header attachment per body type, and shell-safe quoting and escaping — Go Tools Engineering Team · Jun 3, 2026

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 syntax

A 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-focused

Best 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 app

A 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 app

A 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 clients

JavaScript `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. 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. 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. 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. 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. 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. 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.

✗ Wrong
# Intended a PATCH, but -d alone implies POST
curl -d '{"role":"admin"}' \
  https://api.example.com/users/7
✓ Correct
# 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).

✗ Wrong
# Server sees urlencoded, not JSON — 400/415
curl -X POST https://api.example.com/users \
  -d '{"name":"Ada"}'
✓ Correct
# 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.

✗ Wrong
# $name gets expanded by the shell to empty string
curl -d "{\"user\":\"$name\"}" \
  https://api.example.com/users
✓ Correct
# 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".

✗ Wrong
# -d makes this a POST, not a GET
curl -d 'page=2&limit=50' \
  https://api.example.com/users
✓ Correct
# 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`.

✗ Wrong
:: cmd.exe — backslash is not a continuation char
curl -X POST https://api.example.com/users \
  -d '{"name":"Ada"}'
✓ Correct
:: 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.

✗ Wrong
# Space splits the argument — curl sees two args
curl https://api.example.com/search?q=hello world
✓ Correct
# 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?
It builds a ready-to-run curl command from a simple form. You pick the HTTP method, type a URL, add query parameters and headers, choose an authentication scheme (None, Bearer, Basic, or API-key header), set a request body (JSON, form, multipart, or file upload), and toggle option flags like follow-redirects or verbose. As you fill the form, the curl command rebuilds live at the bottom of the page — copy it, export it as a `.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?
No. The entire command is assembled in your browser with JavaScript. Your tokens, credentials, URLs, headers, and request bodies are never transmitted, stored, or logged on any server — you can confirm this in your browser's Network tab, where building a command triggers zero network requests. This is why the tool is safe to use with real production endpoints and live API keys: nothing you type leaves your device. The command only does something when you copy it and run it yourself in your own terminal.
How do I send a POST request with JSON in curl?
Set the method to POST and choose the JSON body type; the tool produces `curl -X POST -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?
Add an `Authorization` header with the value `Bearer YOUR_TOKEN`, or pick the "GET with Bearer" preset and paste your token. The generated command is `curl -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?
Use the Multipart body type and toggle a field to File: the tool emits `curl -X POST -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 `.
Can I import a command copied from browser DevTools ("Copy as cURL")?
Not yet — that's the Convert tab, shipping in the next release. It will parse a pasted curl command (including the one DevTools generates with "Copy as cURL") and translate it into JavaScript fetch, Python requests, Go, PHP, Ruby, and Node.js. For now the tool is a builder: recreate the request by filling in the URL, headers, auth, and body fields manually. The DevTools output is verbose but readable — copy each `-H` header into the headers section and the URL into the URL field.
How is curl on Windows different?
The curl binary behaves the same; the shell quoting differs. In `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?
Use `-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?
Toggle "Follow redirects (-L)" or add the `-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?
Use the "Connect timeout" option to add `--connect-timeout `, which caps how long curl waits to establish the connection. For a ceiling on the entire transfer — connection plus download — add `--max-time ` 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 →