cURL Builder

One input per line. Output is numbered to match the input order.
Pinned tools are listed in your favourites on the home page.Copies a link to this tool that carries your current input, so it opens ready to run.Gives you an iframe snippet for putting this tool on your own site.
Ctrl+Enter Run  · Ctrl+Shift+C Copy  · Esc Clear

Understand cURL Builder

Builds a runnable curl command — and the equivalent JavaScript fetch() call — from a URL, method, headers, body, and authentication.

How it works

The command is assembled from flags rather than free text: `-X` sets the method, each header becomes its own `-H`, `-d` supplies the body, `-u` supplies Basic credentials, and `-L` follows redirects. Values are wrapped in single quotes and any single quote inside the body is escaped as `'\''`, which is the only safe way to embed one in a POSIX shell string. If you supply a body without a Content-Type, one is added for you — application/json when the body starts with `{` or `[`, text/plain otherwise — because curl otherwise defaults to application/x-www-form-urlencoded and the server misreads your JSON. Nothing is sent; the tool only produces text.

When to use it

  • Turning a request you designed in a form into a command you can paste into a terminal, a CI job, or a bug report
  • Producing a reproducible one-liner for a support ticket, where a curl command is the least ambiguous way to describe a request
  • Getting a fetch() skeleton with the headers and body already filled in, to paste into application code
  • Documenting an API endpoint in a README with a copy-paste example that actually runs

Watch out for

  • The single-quoted output is POSIX shell syntax. Windows cmd.exe does not treat single quotes as quoting at all — use Git Bash, WSL, or convert the quoting before running it there.
  • `-k` disables TLS certificate verification for the whole request. It is a debugging flag for a self-signed certificate on a machine you own, never something to leave in a script.
  • Basic auth is Base64, not encryption. The fetch snippet encodes `user:password` with btoa, and anyone who reads the command, the shell history, or the CI log has the password.
  • A generated command contains your real token. Redact it before pasting into an issue, a chat, or a commit.

Frequently Asked Questions

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

Use: curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.com/endpoint. The builder generates this automatically when you choose POST method, add the Content-Type header, and paste your JSON body.

How do I add authentication headers in curl?

For Bearer token: -H "Authorization: Bearer YOUR_TOKEN". For Basic auth: -u username:password (curl encodes this as a Base64 Authorization header automatically) or -H "Authorization: Basic BASE64_ENCODED". The builder has an auth section for both.

How do I convert curl to Python, JavaScript, or Go code?

This tool generates the equivalent JavaScript fetch() call. For other languages, use the curl output — it's the most universal HTTP format. Tools like curlconverter.com convert curl commands to many languages if you need them.

How to Use cURL Builder

  1. Paste or type your input in the input area above.
  2. The tool processes your input automatically or click Run.
  3. Copy or download the result using the action buttons.
  4. Use Ctrl+Enter to run quickly from the keyboard.