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.
⏱ 7 min read · Complete guide below
Headers
How to Generate a cURL Command
- 1Enter your API endpoint URL in the URL field — make sure to include https://.
- 2Select the HTTP method (GET, POST, PUT, PATCH, DELETE, etc.).
- 3Add any headers — such as
Authorization,Content-Type, orAccept. - 4For POST/PUT/PATCH, enter the request body (JSON or form data).
- 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.
The Complete Guide to cURL
cURL is one of the most quietly ubiquitous pieces of software on the planet. Created in 1996 by Daniel Stenberg and still maintained today, it runs on billions of devices — every Mac, most Linux servers, modern Windows, cars, phones, games consoles, and countless embedded systems. For developers it is the universal tool for making HTTP requests from the command line: testing an API, downloading a file, debugging a request, or sharing a reproducible example a colleague can paste and run. This guide explains how a cURL command is built, the flags worth knowing, where it fits in real workflows, and the shell quoting quirks that trip people up.
The Anatomy of a cURL Command
At its simplest, cURL needs only a URL: curl https://api.example.com makes a GET request and prints the response. Everything beyond that is added with flags. The -X flag sets the HTTP method (-X POST, -X DELETE), though you can often omit it since adding a body implies POST. The -H flag adds a header, and you can use it multiple times — one for Content-Type, another for Authorization, and so on. The -d flag supplies a request body, which is how you send JSON to a POST or PUT endpoint.
So a typical authenticated JSON POST reads: curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" -d '{"name":"value"}' https://api.example.com/items. Once you can read that structure — method, headers, body, URL — almost any cURL command becomes legible. This generator assembles exactly this structure for you with correct escaping, which is especially helpful for getting the quoting right around a JSON body.
Essential Flags Every Developer Should Know
A handful of flags turn cURL from a blunt instrument into a precise debugging tool. -iincludes the response headers in the output, and -I fetches only the headers (a HEAD request) — invaluable for checking status codes, caching, and CORS headers. -v (verbose) shows the entire exchange, including the request headers cURL sent and the full response, which is the fastest way to see exactly what is going over the wire. -L follows redirects, so you reach the final destination rather than stopping at a 301 or 302.
For output, -o filename saves the response to a file and -Osaves it under its remote name — cURL is a capable downloader as well as an API client. -s (silent) hides the progress meter, handy in scripts, and -u user:pass handles Basic authentication. A common, powerful combination is piping the output to a JSON processor for readable results: curl -s URL | jq .. Learning these few flags covers the vast majority of everyday cURL usage.
cURL in Real Workflows
cURL earns its place because it slots into so many parts of development. It is the quickest way to test an API endpoint without opening a GUI, and because a cURL command is just text, it is the ideal way to share a reproducible request — paste it into a bug report or a message and anyone can run the exact same call. It is the backbone of countless shell scripts and CI pipelines, used to hit health-check endpoints, trigger deployments, or fetch data as part of an automated job.
A trick worth knowing bridges the browser and the terminal: most browsers' developer tools let you right-click any network request and choose “Copy as cURL,” giving you a fully formed command — headers, cookies, and all — that reproduces exactly what the page did. That is invaluable for debugging and for turning a browser action into a repeatable script. Between building commands here, copying them from devtools, and reusing them in scripts, cURL becomes the connective tissue of a lot of API work.
Shell Escaping and Common Pitfalls
The single most common source of cURL frustration is not cURL at all — it is shell quoting. When you include a JSON body, the shell tries to interpret characters like quotes, spaces, and dollar signs before cURL ever sees them. The safe convention is to wrap the whole body in single quotes (-d '{...}'), because single quotes tell the shell to treat everything literally — but that creates a problem if your JSON itself contains single quotes, which then need careful escaping.
Other frequent snags include forgetting the https:// on the URL, missing the Content-Type: application/json header (so the server does not parse your body as JSON), and differences between shells — Windows Command Prompt handles quoting differently from bash, so a command that works on macOS may need adjusting on Windows. This is exactly why a generator is useful: it applies correct, shell-safe escaping automatically, so you can copy a working command rather than debugging quote errors. Build the request with the fields above, copy the result, and paste a command that just works.
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.