What is the cURL Generator?
cURL is the command-line tool developers use to call APIs and test web servers. Its options are powerful but easy to get wrong: quoting JSON bodies, setting headers, encoding form data and adding authentication all trip people up, and the quoting rules differ between Linux, macOS and Windows.
Fill in the method, URL, query parameters, headers, authentication and body, and the tool writes a correctly quoted command for Bash (Linux and macOS) or Windows CMD, plus the same request as PowerShell, JavaScript fetch and Python requests code. Already have a cURL command, for example copied from your browser’s DevTools? Paste it to load it into the form, then edit or convert it.
How to use it
- Choose the method and enter the URL.
- Add query parameters and headers, and pick an authentication type if needed.
- Add a body: JSON, form fields, multipart (file upload) or raw text.
- Pick the output: cURL for Bash or Windows, PowerShell, fetch or Python, and copy it.
- To edit an existing command, click Import cURL and paste it.
Example
POST https://api.example.com/v1/orders
Authorization: Bearer abc123
Body (JSON): {"item":"tea","qty":2}curl 'https://api.example.com/v1/orders' \
-H 'Authorization: Bearer abc123' \
-H 'Content-Type: application/json' \
--data-raw '{"item":"tea","qty":2}'Features
- Correct quoting. Safe quotes for Bash and Windows CMD, so JSON with quotes and spaces just works.
- Five outputs. cURL (Bash or Windows), PowerShell Invoke-RestMethod, JavaScript fetch and Python requests.
- Import a cURL command. Paste a command (for example “Copy as cURL” from DevTools) and edit it in the form.
- Auth made easy. Bearer tokens, Basic username and password, or an API key in a header or the query.
- Every body type. JSON with validation, URL-encoded forms, multipart uploads and raw text or XML.
- Handy options. Follow redirects, ignore TLS errors, compressed responses, verbose output and timeouts.
Frequently asked questions
How do I send JSON with cURL?
Send the body with --data-raw (or -d) and set the header Content-Type: application/json. On Linux and macOS wrap the JSON in single quotes; in Windows CMD use double quotes and escape the quotes inside with backslashes. This tool handles that for you.
Why does curl not work in PowerShell?
In Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest, which takes different options. Call curl.exe explicitly, or use the PowerShell output here, which uses Invoke-RestMethod.
What do -L, -k and -i do?
-L follows redirects, -k skips TLS certificate checks (only for testing), and -i includes the response headers in the output. -v shows the full request and response for debugging.
How do I copy a request from my browser as cURL?
Open DevTools, go to the Network tab, right-click a request and choose Copy → Copy as cURL. Paste it into Import cURL here to see it in a form or convert it to other languages.
Is my API key safe here?
The command is built in your browser and never sent anywhere, and the form is only remembered on this device. Still, avoid pasting live production secrets into shared screens or chats.
Last updated · Free, no sign-up, runs in your browser.