RunTheTests
/

cURL Command Builder

Assemble a curl command with the shell quoting done properly.

What you provide

How this calculation works

Fill in the parts and the command is assembled with each value quoted for a POSIX shell and the whole thing broken across lines so it can be read and reviewed. The quoting is the part worth automating. Single quotes protect everything except a single quote, which cannot be escaped inside them at all — the only way out is to close the quoting, emit an escaped quote and reopen it. A JSON body containing an apostrophe is not an edge case, and getting this wrong produces a command that silently sends a truncated payload.

What the results mean

Content-Type
With a body and no Content-Type, curl defaults to form encoding. An API expecting JSON rejects a payload that looks perfectly correct, which is a confusing five minutes.
Line continuations
The backslashes keep the command readable across several lines. They are shell syntax, not part of the request.
Quoting
Values are quoted only where they need it, so simple URLs stay legible and anything containing spaces, quotes or shell characters is protected.
Credentials
Flagged when present. A command with a token in it should not reach a ticket, a pull request or a chat message.

Common problems and fixes

The API rejects my JSON body
Add a Content-Type: application/json header. Without one, the payload is sent as form data regardless of what it contains.
The command fails on Windows
The quoting is for a POSIX shell. PowerShell treats single quotes differently and has its own curl alias — use curl.exe explicitly and adjust the quoting.
My body gets truncated
Something in it broke out of the quoting. That is exactly the apostrophe case this tool handles; if you hand-edited the command afterwards, re-generate it instead.

Frequently asked questions

How do I send JSON with curl?

Set the method to POST, put the JSON in the body, and add a Content-Type: application/json header. The header is the part people forget, and without it the payload is sent as form data — which produces a rejection that looks like a problem with the JSON itself.

Why does my command break with an apostrophe in it?

Because a single quote cannot be escaped inside single quotes in a POSIX shell. The value has to close the quoting, emit an escaped quote, then reopen it. This tool does that; hand-written commands frequently do not, and the result is a payload that ends early.

Put this on your own site

Free to embed, no attribution required beyond the source link the frame carries itself. It runs entirely in your visitor's browser, sets no cookies and loads no third-party script.

Embed code
<iframe src="https://runthetests.com/embed/curl-builder/" width="100%" height="560" style="border:1px solid #e5e5e5;border-radius:8px" title="cURL Command Builder" loading="lazy"></iframe>

Preview it at https://runthetests.com/embed/curl-builder/. Embedded pages are marked noindex, so yours stays the canonical copy — not this one.

More in DevOps