Skip to content
API & TESTING TOOLS

cURL Command Generator Online

Generate a cURL command from a method, URL, headers and body.

  • Free
  • No signup
  • Runs in your browser

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

cURL Command Generator

About cURL Command Generator

cURL is the command-line tool used to call APIs from a terminal, and API documentation is full of cURL examples. Writing one by hand means getting quotes, headers and JSON bodies exactly right.

Describe the request like a simple HTTP message: the first line has the method and URL, the following lines are headers, then a blank line, then the body. The tool writes a cURL command with -X, one -H per header and --data for the body, and escapes single quotes so the command is safe to paste into a Linux, macOS or Git Bash terminal.

How to use cURL Command Generator

  1. Write the method and URL on the first line, for example POST https://api.example.com/users.
  2. Add headers on the next lines, then a blank line and the body if there is one.
  3. Click Run Tool and paste the command into your terminal.

Example

Input

POST https://api.example.com/users
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{"name":"Aman","course":"PHP"}

Output

curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --data '{"name":"Aman","course":"PHP"}' \
  'https://api.example.com/users'

Common uses

  • Creating a command to share in a bug report or in documentation.
  • Testing an API endpoint from a server over SSH.
  • Turning a request you designed into a command you can run and tweak.

Privacy and safety

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

Frequently asked questions

What if I only enter a URL?

A request with only a URL is treated as GET and the command is just curl followed by the quoted address.

How do I send JSON?

Add a Content-Type: application/json header and put the JSON on its own after the blank line.

Does it work in Windows Command Prompt?

The quoting follows Linux, macOS and Git Bash rules. In Windows PowerShell or Command Prompt, quotes are handled differently, so adjust them or use Git Bash.

Learn to build this yourself

Free tutorials and courses on NHP Learning cover PHP, JavaScript, SQL and WordPress, from the basics to real projects.