Quick access

Saved in this browser. Sign in to keep it on all your devices.

cURL Generator

Build and visualize cURL commands from form inputs.

cURL Command

Quick Headers

Presets

Version 1.1 Updated What's new

Release notes

  1. v1.1 Latest
    • Added an in-depth guide below the tool, written from what the tool actually does.
    • Values are now quoted safely for the shell in the generated command.

About the cURL Generator

cURL is a command-line tool for sending HTTP requests. The generator builds the full command, with headers, authentication, and a JSON body, from a simple form.

How to use it

  1. 1 Enter the URL and choose the method.
  2. 2 Add headers and a request body.
  3. 3 Copy the cURL command and run it in your terminal.

Frequently asked questions

How do I send JSON with cURL?

Add -H "Content-Type: application/json" and pass the body with -d '{"key":"value"}'.

How do I add a bearer token?

Add the header -H "Authorization: Bearer YOUR_TOKEN".

Does cURL work on Windows?

Yes. Windows 10 and later include curl.exe. In PowerShell, use double quotes and escape inner quotes, or run it in Git Bash.

What each part of the command does

Fill in the form and the command updates as you type. Nothing is sent from this page, because the tool only writes text for you to run yourself. A POST with a JSON body looks like this:

curl -X POST 'https://api.example.com/items' \
  -H 'Content-Type: application/json' \
  --data-raw '{"name":"Ann"}'
  • -X sets the HTTP method. A plain GET needs no flag.
  • -H adds one header. Repeat it for each header you need.
  • --head asks for headers only, and is the correct way to send a HEAD request, because -X HEAD leaves curl waiting for a body that never arrives.

Four kinds of request body

JSON and Raw use --data-raw, which sends your text exactly. The older -d flag treats a leading @ as an instruction to read a file, so a body beginning with @ would go wrong.

Form Data uses -F, which produces multipart/form-data, the encoding browsers use for file uploads. URL Encoded uses --data-urlencode, which percent-encodes each value for you. For both, write name=value pairs on separate lines or join them with &.

Why everything is in single quotes

Inside double quotes a Unix shell still expands $VARIABLES and backticks, so a password containing a dollar sign would silently change. Single quotes switch all of that off. The only character that needs care is the single quote itself, which is written by closing the string, adding an escaped quote and reopening it:

O'Brien   becomes   'O'\''Brien'

The URL is quoted for a related reason. An unquoted & tells the shell to run the command in the background and cut the URL off at that point.

Running it on Windows

The generated command is written for bash, zsh and Git Bash. The Windows command prompt does not treat single quotes as quotes and continues lines with ^ in place of a backslash. In Windows PowerShell 5, the word curl is an alias for Invoke-WebRequest, so type curl.exe to reach the real program. Git Bash and WSL run the output unchanged.

Sending a header with no value

Passing -H with a name and an empty value tells curl to remove that header. To send it empty on purpose, curl expects a semicolon after the name, as in -H 'X-Request-ID;'. If you leave the value box blank, this generator writes it that way.