cURL Command Generator
Generate cURL commands easily with this online cURL command builder. Configure HTTP methods, headers, authentication, request body, and advanced options to create ready-to-use cURL commands. Perfect for API testing, debugging, and sharing HTTP requests.
Request Configuration
Generated cURL Command
Generated command will appear here
Enter a URL to start building your cURL command
About cURL Commands
What is cURL? cURL is a command-line tool for making HTTP requests. It's widely used for testing APIs, debugging web services, and automating HTTP interactions.
Automatic Escaping: This tool automatically escapes special characters in your headers, body, and other parameters to ensure your cURL command works correctly in the shell.
Line Breaks: Long commands are formatted with backslashes (\) for better readability. These allow you to split the command across multiple lines in your terminal.
Common Options: The tool supports the most commonly used cURL options including custom headers (-H), request methods (-X), authentication (-u), request data (-d), and various flags like -L (follow redirects), -v (verbose), and -k (insecure).
About cURL Command Generator
The cURL Command Generator is a comprehensive tool for building cURL commands with a user-friendly interface. Configure all aspects of an HTTP request including URL, method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS), custom headers, request body, and authentication (Bearer token, Basic Auth, API key header). Put any query string directly in the URL. Includes advanced options like follow redirects (-L), verbose mode (-v), insecure SSL (-k), custom user agent, timeout and max-redirect settings, and saving to a file. Generate properly formatted cURL commands with every value shell-escaped in single quotes, and copy them with one click. Ideal for developers who need to quickly construct cURL commands without memorizing syntax.
Why use a cURL Command Generator?
Constructing cURL commands manually can be error-prone and time-consuming, especially when dealing with complex authentication, multiple headers, or special characters that need escaping. This cURL command generator simplifies the process with an intuitive interface that handles all the complexity for you. Build commands visually, preview them in real-time, and copy production-ready commands with proper escaping. Perfect for creating cURL examples for documentation, sharing API requests with team members, testing endpoints during development, or learning cURL syntax. The tool automatically formats long commands with line breaks for readability and ensures special characters are properly escaped.
Who is it for?
Essential for backend developers testing APIs, DevOps engineers debugging HTTP endpoints, QA testers validating API behavior, and technical writers creating API documentation with cURL examples. Perfect for developers learning cURL syntax, teams standardizing API testing procedures, API providers documenting endpoints with example commands, and anyone who needs to quickly generate cURL commands without memorizing complex syntax and escaping rules.
How to use the tool
Enter the target URL for your HTTP request, including any query string
Select the HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS)
Add custom headers with key-value pairs (add or remove as needed)
Configure authentication: Basic Auth, Bearer Token, or API Key
Add request body for POST/PUT/PATCH requests (a single text box sent with -d; add a Content-Type header yourself)
Enable advanced options like follow redirects, verbose mode, or insecure SSL
Set custom user agent, timeout, or max redirects if needed
Configure output options like saving to file or including headers
View the generated cURL command, which updates as you type
Copy the command with one click to use in terminal or documentation
Use the clear/reset button to start over with a new command
Frequently Asked Questions
How do I generate a curl command online?
Fill in the URL (with any query string), HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS), headers (Content-Type, Authorization, custom), an optional request body, authentication (Basic, Bearer or API key header), and any advanced options such as follow redirects, verbose, insecure, user agent, timeout, max redirects or output file. The tool builds the equivalent curl command as you type. Copy and paste into a terminal. The body is a single text box sent with `-d` and only for POST, PUT and PATCH; there are no separate query-parameter, form-data or file-upload fields. Runs entirely in your browser — your inputs never leave the device. Useful for: API debugging, sharing reproducible requests with team, documenting API calls.
What is curl?
curl is a command-line tool for transferring data via URLs — primarily HTTP/HTTPS but also FTP, SCP, IMAP, and many other protocols. Available on virtually every OS (preinstalled on macOS/Linux; widely installable on Windows). Used for: API testing, downloading files, scripting HTTP interactions, network debugging. curl's syntax: `curl [options] <URL>`. The tool generates the full command including all the options matching your specified request.
Is my data sent to a server?
No — command generation runs entirely in your browser. The tool builds the curl command string from your inputs; no actual HTTP request is made by the tool itself. Your request data (URL, headers, body) is used only to construct the command string. No network requests are made while you type. Verify in DevTools' Network tab. Safe for sensitive API credentials and request data.
What's the difference between curl and a GUI API client?
**curl**: command-line, scriptable, no GUI; native on every Unix-like system; great for automation, scripts, CI/CD. **GUI API clients**: applications with collections of requests, environments and automated tests; great for interactive API exploration and team collaboration. Both make HTTP requests; curl is for automation. This generator helps bridge: design the request in a visual form, then export as curl for scripts. To actually send a request from your browser, use the [API Tester](/tools/api-tester/).
How do I send a POST request with JSON body?
`curl -X POST -H 'Content-Type: application/json' -d '{"key":"value"}' https://api.example.com/endpoint`. Breakdown: `-X POST` sets the method, `-H 'Content-Type: application/json'` sets the header, `-d '{...}'` sets the body. To get this from the tool, choose POST, add a `Content-Type: application/json` header row, and type the JSON in the Request Body box — the tool does not add the Content-Type header for you (without it, curl sends `application/x-www-form-urlencoded`). For larger JSON, use `-d @file.json` to read from a file (edit the copied command). For HTTPS endpoints with self-signed certs (dev only), tick the insecure option (`-k`).
How do I include authentication?
Several methods. **Bearer token (OAuth/JWT)**: the tool generates `-H 'Authorization: Bearer YOUR_TOKEN'`. **Basic auth**: it generates `-u 'username:password'`. **API key in header**: it generates `-H 'X-API-Key: YOUR_KEY'` (the header name is editable). **API key in query string**: include it in the URL, `?api_key=YOUR_KEY`. **Cookies for session auth**: the tool has no cookie option; add `-b 'sessionid=abc'` to the copied command. For sensitive credentials in scripts, use environment variables — but the tool wraps every value in single quotes, where the shell does not expand variables, so after copying, switch to double quotes by hand: `-H "Authorization: Bearer $API_TOKEN"`.
Can I generate curl commands for HTTPS APIs?
Yes — HTTPS is the default. curl uses the OS's CA bundle for certificate verification automatically. For APIs with self-signed certs (dev environments), tick the insecure option, which adds `-k` (`--insecure`) to skip verification — production code should never use `-k`. For client certificate auth (`mTLS`), add `--cert client.pem --key client.key` to the copied command; to force a TLS version, add `--tlsv1.2` or `--tlsv1.3`. The tool has no fields for those last options.
How do I follow redirects?
Tick 'follow redirects' (adds `-L` / `--location`): `curl -L https://example.com/redirect-source`. Without `-L`, curl stops at the first response and shows the 3xx redirect itself instead of following it to the final destination. With `-L`, curl follows the redirect chain (up to a default limit, configurable with the max redirects field, `--max-redirs`). For debugging redirect chains, tick verbose (`-v`) to see each redirect step. For requests where you want to inspect the redirect response (e.g., the Location header), leave `-L` off.
Share This Tool
Found this tool helpful? Share it with others who might benefit from it!
💡 Help others discover useful tools! Sharing helps us keep these tools free and accessible to everyone.