cURL Generator
Compose a copy-pasteable, shell-escaped curl command from a method, URL, headers and body.
- Runs locally in your browser
- No upload required
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Built a curl command with 11 argument(s).
How it works
- Selected the method with -X and single-quote escaped the URL.
- Appended -L, -k and --compressed only when the matching options were enabled.
- Converted each header line to a -H argument with its name and trimmed value.
- Added --data-raw with the body when a body was supplied.
- Everything is single-quote escaped, so characters such as $, ` and " stay literal inside the shell.
- The tool only builds the command text; it does not run curl or make any network request.
Methodology
- Start the argument list with curl, -X and the upper-cased method.
- Single-quote escape the absolute URL and append the -L, -k and --compressed flags when enabled.
- Parse the header block into `Name: value` lines, trim the value and append each as a -H argument.
- Append --data-raw with the body when the body is non-empty.
- Join the arguments with spaces to form the final command.
Usage
- Choose the HTTP method and enter an absolute http(s) URL.
- Add one header per line as `Name: value`.
- Optionally add a body and toggle the redirect, insecure and compression flags.
- Copy the generated command and paste it into a POSIX shell.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
POST JSON with a header
{
"method": "POST",
"url": "https://api.example.com/items",
"headers": "Content-Type: application/json\nAuthorization: Bearer token",
"body": "{\"name\":\"widget\"}",
"followRedirects": true,
"insecure": false,
"compressed": false
}Simple GET
{
"method": "GET",
"url": "https://example.com/search?q=hello world",
"headers": "",
"body": "",
"followRedirects": false,
"insecure": false,
"compressed": true
}Limitations
Shell safety
An unquoted URL or header value containing a space, a semicolon or a dollar sign can be re-interpreted by the shell. The generator single-quote escapes every dynamic value, which makes the command inert: the shell passes the literal bytes to curl. Review a command you did not build before running it, especially when it carries an Authorization header.
What is not generated
The tool does not generate multipart uploads, client certificates, cookies from a jar, or authentication handshakes that need a prior request. Those flows are explicit state, and hiding them inside a one-line generator would be misleading.
Frequently asked questions
- Will the generated command run my request automatically?
- No. The page only produces the command text. You decide when and where to run it; nothing is sent from this page.
- How is quoting handled?
- Every dynamic value is wrapped in single quotes and an embedded single quote becomes '\''. That is the portable POSIX escape, so an URL with spaces or a body with $ and backticks stays literal.
- Can I use this command in Windows PowerShell?
- The tokens are valid, but Windows shells treat single quotes differently. Prefer a POSIX shell (bash, zsh, sh) or rewrite the quoting for your shell.
Sources
- RFC 9110 — HTTP Semantics — IETF
- curl — command line options — curl project
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.