PublicSoftTools

cURL Command Generator Online Free

Fill in the URL, HTTP method, headers, and body — get a ready-to-paste cURL command instantly. Supports GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS.

How to Generate a cURL Command

  1. 1Enter your API endpoint URL in the URL field — make sure to include https://.
  2. 2Select the HTTP method (GET, POST, PUT, PATCH, DELETE, etc.).
  3. 3Add any headers — such as Authorization, Content-Type, or Accept.
  4. 4For POST/PUT/PATCH, enter the request body (JSON or form data).
  5. 5The cURL command is generated live. Click Copy Command and paste it into your terminal.

Common cURL Patterns

A basic GET request needs only a URL — curl uses GET by default. A JSON POST request needs a URL, the -X POST flag, a Content-Type: application/json header, and a -d flag with the body. An authenticated request adds an Authorization: Bearer token header. This generator handles all of these patterns with correct shell escaping.

cURL Tips for Developers

Pretty-Print JSON Responses

Pipe the curl output through a JSON formatter: curl ... | python -m json.tool or curl ... | jq . for coloured, indented JSON in the terminal.

Save Response to a File

Add -o filename.json to save the response body to a file instead of printing it. Use -O to save with the remote filename. Useful for downloading API responses for later inspection.

Include Response Headers

Add -i to include the response headers in the output. Add -I (HEAD) to fetch only headers without the body — useful for checking CORS headers and cache settings.

Test with the REST API Tester

Use the REST API Tester tool to make the actual request from your browser and inspect the response. Copy the generated cURL command here for reuse in scripts or sharing with your team.

Frequently Asked Questions

What is cURL and why is it useful?

cURL (Client URL) is a command-line tool for making HTTP requests. It is pre-installed on macOS, Linux, and Windows 10/11, and is the standard way to test APIs, download files, and debug HTTP interactions from the terminal. Developers use cURL to quickly verify API endpoints, reproduce bugs, share reproducible request examples with colleagues, and test authentication flows without needing a GUI application.

Which HTTP methods are supported?

The generator supports GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS — the full set of standard HTTP methods used by REST APIs. GET is the default and omits the -X flag since curl uses GET by default. All other methods include -X METHOD in the generated command.

How do I add authentication headers?

Add an Authorization header with your token in the Headers section. For Bearer token auth: key = Authorization, value = Bearer your-token-here. For Basic auth: key = Authorization, value = Basic base64(username:password). You can use our Base64 Encoder tool to compute the Basic auth value.

What does the -L flag (Follow redirects) do?

The -L flag tells curl to follow HTTP redirects (301, 302, 307, 308). Without -L, curl stops at the redirect response and prints the redirect headers. With -L, curl follows the redirect chain until it reaches the final destination. Most API endpoints don't redirect, but enabling -L is a safe default for web pages and some authentication flows.

What does the -v flag (Verbose) do?

The -v flag makes curl print full request and response details to stderr: the request headers sent, the response status line, and all response headers received, in addition to the response body. It is essential for debugging — it shows exactly what curl sent and what the server replied with, including SSL handshake details.

How do I send a JSON body with POST?

Select POST (or PUT/PATCH), set the Content-Type header to application/json, and paste your JSON into the Request Body field. The generator wraps the body in single quotes and adds the -d flag. For complex JSON with single quotes inside, the generator escapes them correctly with the shell-safe '\'' pattern.