curl Command Builder

Build a correct curl command from a form: method, headers, auth, JSON or multipart body, and options. Quoting handled for Bash, PowerShell and CMD.

Advertisement

Free Online cURL Command Builder and Generator

This cURL command builder turns a form into a correct, copy-ready curl command. Choose an HTTP method, add headers and authentication, attach a JSON body or a multipart upload, set the options you need, and the command is generated live — correctly quoted and line-wrapped for Bash, PowerShell or Windows CMD, each of which escapes strings differently. It also generates the install command for curl on Windows, macOS and Linux if you do not have it yet. Everything runs in the browser; nothing you type is transmitted anywhere and no request is ever sent from this page.

The reason to use a builder rather than typing from memory is quoting. A JSON body containing double quotes works one way in Bash, another in PowerShell (where curl may also be an alias for Invoke-WebRequest unless you call curl.exe), and a third in CMD. Most “curl doesn’t work on Windows” problems are shell quoting, not curl.

How to Use It

  1. Pick a mode: Install for platform install commands, or Build to construct a request.
  2. Choose your shell — Bash, PowerShell or CMD. This changes quoting and the line-continuation character (\, backtick, or ^).
  3. Enter the URL and pick a method: GET, POST, PUT, PATCH, DELETE or HEAD.
  4. Add headers, either by hand or from presets for Content-Type: application/json, Accept: application/json and User-Agent.
  5. Choose an authentication type: none, HTTP Basic, Bearer token, or a custom API-key header.
  6. Choose a body type: none, raw JSON, multipart form, file upload, or URL-encoded form fields.
  7. Toggle the options you want — follow redirects, show response headers, verbose, silent, output to a file, timeout, retries, proxy, download mode with resume.
  8. Copy the finished command.

The Flags That Matter

FlagLong formWhat it does
-X--requestSets the HTTP method. Often unnecessary: -d already implies POST.
-H--headerAdds a request header. Repeat for each one.
-d--dataSends a request body and implies POST. Defaults to application/x-www-form-urlencoded unless you set Content-Type.
--data-rawLike -d but does not treat a leading @ as a filename. Safer for arbitrary strings.
--data-urlencodePercent-encodes each field before sending. The right choice for form values containing spaces or symbols.
-F--formSends multipart/form-data. Use -F "file=@/path/to/file" to attach a file.
-u--userHTTP Basic authentication as user:password.
-o--outputWrites the response body to a named file.
-O--remote-nameSaves using the filename from the URL.
-L--locationFollows redirects. Without it curl prints the 301 and stops.
-i--includeIncludes response headers in the output.
-I--headSends a HEAD request — headers only, no body.
-v--verbosePrints the full request and response exchange, including the TLS handshake. The first thing to reach for when debugging.
-s--silentSuppresses the progress meter. Standard in scripts.
-k--insecureDisables TLS certificate verification. See the warning below.
--compressedRequests a compressed response and decompresses it transparently.
-C ---continue-atResumes an interrupted download from where it stopped.
--max-timeHard ceiling in seconds on the whole operation.
--retryRetries transient failures the given number of times.
-x--proxyRoutes the request through a proxy.

A Warning About -k / --insecure

-k tells curl to accept any TLS certificate without verifying it — expired, self-signed, wrong hostname, or issued by an attacker. It does not fix a certificate problem; it hides one, and it removes the protection that makes HTTPS meaningful, leaving the connection open to interception.

Use it only as a deliberate, temporary diagnostic on a controlled system: confirming that a service is reachable at all before you deal with its certificate, or testing a host whose certificate you know is self-signed. Never put it in a script, a deployment, a container image, a CI job or anything that runs unattended. If you need curl to trust a private CA, do that properly with --cacert /path/to/ca.pem, which keeps verification switched on. The builder flags -k with a warning whenever you enable it, for exactly this reason.

Worked Examples

POST JSON with a bearer token (Bash):

curl -X POST "https://api.example.com/v1/users" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9..." \
  -d '{"name":"Ada Lovelace","role":"admin"}' \
  -i

The same request in PowerShell, where single quotes do not interpolate and the continuation character is a backtick. Note curl.exe rather than curl, so PowerShell does not route the call to Invoke-WebRequest:

curl.exe -X POST "https://api.example.com/v1/users" `
  -H "Content-Type: application/json" `
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9..." `
  -d '{\"name\":\"Ada Lovelace\",\"role\":\"admin\"}' `
  -i

Multipart file upload:

curl -X POST "https://api.example.com/v1/documents" \
  -H "X-API-Key: abc123" \
  -F "file=@/home/me/report.pdf" \
  -F "title=Q3 Report"

Do not set Content-Type: multipart/form-data by hand when using -F. curl generates the header along with the boundary string; overriding it produces a body the server cannot parse, which is one of the more baffling upload failures to debug.

Resumable download through a proxy, with a timeout and retries:

curl -L -O -C - \
  --max-time 600 \
  --retry 3 \
  -x http://proxy.internal:3128 \
  "https://releases.example.com/app-2.4.1.tar.gz"

Debugging a Failing Request

Add -v first. It shows DNS resolution, the TLS handshake including the certificate chain, every request header curl actually sent, and the full response status line and headers. Most failures identify themselves immediately: a 401 means the auth header is wrong or missing, a 415 means the Content-Type does not match the body, a 301 with no -L means you are reading the redirect rather than the target, and a TLS error before any HTTP exchange means a certificate or protocol problem rather than an application one.

Two more habits worth adopting. Use -w "\n%{http_code} %{time_total}s\n" to print the status code and timing without parsing the body. And in scripts, combine -sS so the progress meter is suppressed but errors still print, and add -f so an HTTP error status makes curl exit non-zero — without it, a script will happily treat a 500 response body as success.

Related Tools

Once you have a response, the JSON formatter makes it readable, the JWT decoder unpacks the bearer token you are sending, and the Base64 encoder and decoder handles the Basic auth string. If a request is failing at the network layer rather than the application layer, start with the DNS lookup tool and the SSL certificate checker.

Frequently Asked Questions

Does this tool send my request?

No. It only generates command text. Nothing is executed and nothing you type — including tokens, passwords and URLs — leaves your browser.

Why does my command work in Bash but not PowerShell?

Quoting and escaping differ. PowerShell handles single and double quotes differently from Bash, uses a backtick for line continuation, and may alias curl to Invoke-WebRequest. Select PowerShell as the shell in the builder, and call curl.exe explicitly.

What is the difference between -d and -F?

-d sends a raw body, defaulting to URL-encoded form content, and is what you use for JSON APIs. -F sends multipart/form-data, which is what you need for file uploads.

Do I still need -X POST if I use -d?

No. -d already switches the method to POST. Adding -X POST is harmless but redundant — and adding -X alongside -L can cause surprises, because it forces the original method to be reused on the redirect.

Is it safe to use -k?

Only as a deliberate one-off diagnostic on a system you control. It switches off TLS certificate verification entirely, so the connection can be intercepted without any warning. To trust a private CA properly, use --cacert instead and keep verification enabled.

How do I upload a file?

Use -F "field=@/path/to/file". The @ tells curl to read the file’s contents. Let curl set the Content-Type header itself.

How do I send a Bearer token?

As a header: -H "Authorization: Bearer <token>". Select Bearer in the auth section and the builder adds it for you. Avoid putting tokens directly in shell history — read them from an environment variable in real scripts.

Why does curl return nothing on a URL that works in my browser?

Usually a redirect that you are not following — add -L. Failing that, the server may be varying on User-Agent, or requiring a cookie or header the browser sends automatically. Run with -v to see exactly what came back.

Can curl resume an interrupted download?

Yes, with -C -, provided the server supports range requests. Combine it with -L -O for the usual download pattern.

Do I need to install curl?

Probably not. curl ships with Windows 10 build 1803 and later, with macOS, and with nearly every Linux distribution. The Install mode covers winget, Chocolatey, Scoop, Homebrew, apt, dnf, yum and apk if you need a newer build than the one you have.

What Is the curl Command Builder

curl is the de facto standard command-line tool for making HTTP requests — testing APIs, downloading files, debugging webhooks, and scripting integrations. It ships with Windows 10 (1803+), macOS, and virtually every Linux distribution, but its dozens of flags and shell-specific quoting rules make commands fiddly to write by hand.

This tool builds complete curl commands from a simple form: choose a method, add headers and authentication, attach a body, and copy a command formatted correctly for your shell. It also generates the install commands for platforms where curl is missing.

Shell Differences That Break curl Commands

PowerShell aliases curl to Invoke-WebRequest. In Windows PowerShell 5.1, typing curl does not run curl at all — it runs a different cmdlet with incompatible flags. Generated PowerShell commands use curl.exe explicitly to bypass the alias.

Quoting rules differ by shell. Bash and zsh use single quotes for literal strings; PowerShell treats single quotes literally but uses backticks for line continuation; cmd.exe only supports double quotes and uses ^ for continuation. JSON request bodies are the most common casualty — a body that works in bash will silently mangle in cmd.exe without re-quoting.

Common Use Cases

  • API testing: POST JSON to a REST endpoint with a bearer token and inspect the response headers
  • File downloads: download a release artifact following redirects, with resume support for large files
  • Webhook debugging: replay a webhook payload against a local development server
  • Health checks: script an endpoint check with timeouts and retries for monitoring
  • Authentication flows: test Basic, Bearer, and API-key authentication without writing code

Best Practices

Never use -k (insecure) outside of local development. Disabling certificate verification removes the protection TLS provides. If a certificate fails validation, fix the certificate or trust chain instead.

Prefer --data-urlencode for form data with special characters. Manually URL-encoding values is error-prone; let curl do it.

Use -sS in scripts. Silent mode (-s) suppresses the progress bar that pollutes logs, while -S keeps real errors visible.

Set explicit timeouts in automation. Without --max-time, a hung server can stall a script indefinitely. Pair it with --retry for resilient health checks.

Keep credentials out of shell history. Tokens passed with -H "Authorization: Bearer ..." end up in your shell history file. For sensitive workflows, read tokens from environment variables or use --netrc.

Frequently Asked Questions

Do I need to install curl on Windows 10 or 11?+

Usually not. Windows 10 build 1803 (April 2018) and later ship curl.exe in C:\Windows\System32, so it works out of the box in Command Prompt and PowerShell. Run curl --version to confirm. If you want the newest release, install it with winget (winget install cURL.cURL), Chocolatey, or Scoop.

Why does curl behave strangely in PowerShell?+

In Windows PowerShell 5.1, curl is an alias for the Invoke-WebRequest cmdlet, which uses completely different parameters than real curl. That is why curl commands copied from tutorials often fail. Call curl.exe explicitly to run the actual curl binary. This tool always emits curl.exe for the PowerShell target. PowerShell 7+ removed the alias.

How do I send JSON in a POST request with curl?+

Set the method to POST, add a Content-Type: application/json header, and pass the body with -d. For example: curl -X POST -H "Content-Type: application/json" -d '{"name":"Ada"}' https://api.example.com/users. On Windows cmd.exe, escaping JSON is painful, so consider saving the body to a file and using -d @body.json instead.

How do I add a Bearer token or API key to a curl request?+

For a Bearer token, send an Authorization header: -H "Authorization: Bearer YOUR_TOKEN". For an API key, most APIs expect a custom header such as -H "X-API-Key: YOUR_KEY". Basic authentication uses -u username:password instead. This builder generates all three from the Authentication section.

How do I download a file with curl?+

Use curl -L -O https://example.com/file.zip. The -O flag saves the file using its remote name, and -L follows any redirects to the real download URL. To save under a different name use -o myname.zip. To resume an interrupted download, add -C - so curl continues where it left off.

What does the -k (insecure) flag do, and is it safe?+

The -k or --insecure flag tells curl to skip TLS certificate validation, so it will connect even if the certificate is self-signed, expired, or mismatched. This removes the protection against man-in-the-middle attacks, so only use it for local development against test servers. Never use -k against production endpoints or when transmitting secrets.

How do I handle quoting differences between bash, PowerShell, and cmd.exe?+

bash and zsh use single quotes around values, which preserve everything literally. PowerShell also uses single quotes but doubles any inner single quote. cmd.exe has no single-quote support, so values are wrapped in double quotes with inner double quotes doubled. Line continuations differ too: bash uses a trailing backslash, PowerShell a backtick, and cmd.exe a caret (^). Select your shell in the builder and it generates the correct syntax.

How do I follow redirects and see response headers with curl?+

Add -L to follow HTTP 3xx redirects to the final URL, and -i to include the response headers in the output along with the body. Use -I (capital i) to fetch only the headers with a HEAD request. Combine with -v for full verbose output that shows the request and TLS handshake, which is invaluable for debugging.

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.