curl Command Builder

Build a ready-to-run curl command from a method, URL, headers and body, with values quoted and escaped for safe pasting into a terminal.

Basic authentication (optional)
curl options
curl
curl -X GET 'https://api.example.com/users' -H 'Content-Type: application/json'
curl -X GET 'https://api.example.com/users' -H 'Content-Type: application/json'

Building a curl command piece by piece

The curl Command Builder turns the pieces of an HTTP request into a copy-paste-ready curl command. Pick a method such as GET or POST, enter the request URL, list your headers one per line as Key: Value, and optionally add a request body. The command updates live below and includes -X for the method (-I for HEAD), a -H flag for every header, and --data when a body is present. Every value is wrapped in single quotes and any embedded quotes are escaped, so the output pastes safely into a terminal exactly as shown.

How to use it

Choose the HTTP method from the dropdown, then paste the full URL you want to call. Add each header on its own line, for example Content-Type: application/json or Authorization: Bearer TOKEN. If you are sending data, type or paste it into the body field — JSON, form text, or anything else. Watch the curl command build in real time, then press Copy and run it in your terminal, drop it into a script, or share it with a teammate.

Frequently asked questions

How are quotes and special characters handled?

Each URL, header and body value is wrapped in single quotes, and any single quote inside a value is safely escaped using the POSIX '\'' sequence. This means the command pastes into a shell exactly as written, even when values contain spaces, ampersands or JSON.

Why does GET still show -X GET?

The builder writes the method explicitly with -X so the command is unambiguous and easy to edit. HEAD is the one exception: it is written as -I, because curl -X HEAD waits for a response body that a HEAD reply never sends. curl treats GET as the default, so -X GET behaves the same as leaving it out — you can delete it if you prefer the shorter form.

Can I add the usual curl options and basic authentication?

Yes. Checkboxes add verbose, insecure, include-headers and fail-on-error, with fields for a connect timeout and a file to save to, and a Basic auth field writes the credentials the way each output language expects. An option the fetch or PowerShell output cannot carry is named as left out.

Can I send the request through a proxy?

Yes. Type the proxy address into Proxy (optional: curl -x, PowerShell -Proxy) and the curl output gains -x with the address quoted for the shell, while the PowerShell output gains -Proxy with it quoted PowerShell’s way. fetch() has no proxy setting, so with JavaScript (fetch) chosen the proxy is left out and a note under the command says so; switch to curl or PowerShell to go through it.

How do I install curl?

It already comes with macOS and with current versions of Windows. In Windows PowerShell, type curl.exe, because plain curl there is another name for Invoke-WebRequest — or pick PowerShell as the Output format and this page writes an Invoke-RestMethod command instead. On Linux, install the curl package, for example sudo apt install curl or sudo dnf install curl.

How do I follow a redirect?

Add -L (--location) to the command after you copy it; this page has no switch for it. Without -L, curl stops at the redirect and prints that response's body, which is often empty; with it, curl goes on to the address in the Location header.

How do I set a user agent?

Put a User-Agent line in the Headers box, for example User-Agent: my-script/1.0, and the command gains -H 'User-Agent: my-script/1.0' — the same header curl's own -A option sets. Without one, curl sends its own name and version.

How do I see the response headers?

Tick Show response headers (-i) and curl prints the status line and headers above the body. For the headers alone, choose HEAD as the Method: this page writes it as -I, which asks for the headers and no body.

What does Accept self-signed certificates (-k) do?

It tells curl not to check the server's TLS certificate at all, so any certificate is accepted — a forged one included. Use it for a test server with a self-signed certificate, never for a real site or a request that carries a password or a token.

Can I save the command as a script?

Yes. Download saves the command in a file named for the output format: curl-builder.sh for curl, curl-builder.js for JavaScript (fetch) and curl-builder.ps1 for PowerShell, ready to run or to drop into a project. Copy puts the same text on the clipboard.