cURL parser
Runs in your browser; nothing is uploaded
Read a cURL command as the request it sends, and turn it into fetch, Python requests or tidy bash. Nothing is sent.
Command
No command yet
What is a cURL command?
cURL is a command-line program for sending HTTP requests, and a cURL command is the most common way developers share a request. One line holds everything the server receives: the method after -X, the URL, each header after -H and the body after -d.
You meet cURL commands everywhere in API work. API documentation shows examples as cURL, browser developer tools offer Copy as cURL on any network request, and bug reports often include one so the problem can be repeated exactly.
curl adds parts of the request that the command doesn't spell out, and those are the ones that catch people. -d turns a GET into a POST and sends Content-Type: application/x-www-form-urlencoded, so a JSON body without a JSON Content-Type reaches the server as a form. Several -d options are joined with &. -G moves the data into the query string instead, and -u user:password becomes a Basic Authorization header. The parser shows these headers and marks which option added them.
How to use this tool
- 1Paste a command into the Command pane, or pick one from Examples. Commands copied from Chrome or Firefox work as they are, including Copy as cURL (cmd) from Windows with its
^escapes, and PowerShell commands with backtick line continuations. - 2Read the request in the Request tab: the method and why curl uses it, the URL split into parts, query parameters, headers, the body (JSON is pretty-printed without changing any value) and options the parser lists but doesn't interpret.
- 3Notes at the top of the Request tab point out things worth knowing, such as a JSON body sent as a form. Show, or F8, puts the cursor on the option concerned.
- 4Open the Code tab to get the same request as JavaScript fetch, Python requests or a tidy multi-line bash command, and copy it.
- 5Tidy (Shift+Alt+F) rewrites the command in the editor as bash, one option per line. Ctrl+Z undoes it.
Troubleshooting
- Unclosed single quote, or Unclosed double quote
- A quote opens and never closes, so the rest of the command is read as one argument. In bash, a single quote can't appear inside '…'; write it as
'\''or use$'…'. The editor marks where the quote opens. - No URL found
- Every argument was read as an option or an option's value. Check that the URL is there and not inside an unclosed quote, and that an option such as
-oor-uhas its own value before the URL. - The body looks like JSON but is sent as a form
-dwith no Content-Type makes curl sendapplication/x-www-form-urlencoded. Add-H "Content-Type: application/json", or use--json, which sets both Content-Type and Accept.- The URL contains [ ] or { }
- curl treats them as a pattern and sends several requests, one for each value. Add
-g(--globoff) to send them as written. - This is a wget command, not curl
- The parser reads curl only. A command copied as PowerShell from the browser uses
Invoke-WebRequest; choose Copy as cURL instead.
Frequently asked questions
Is my command sent anywhere?
No. The command is parsed in your browser and no request is made. That matters because copied commands often contain real tokens and cookies. The command is kept in this tab's session storage until you clear it or close the tab; Copy link puts it in the link after # (never sent to a server), so check it for credentials before sharing.
Which cURL options does the parser understand?
The ones that change the request: -X, -H, -d and its variants (--data-raw, --data-binary, --data-urlencode), --json, -F, -G, -I, -T, -u, -b, -A, -e, --oauth2-bearer, -L, -k, -m and --compressed. Short options can be combined, as in -sSL, or have their value attached, as in -XPOST. Other options are listed with what they do, and unknown ones are listed too rather than dropped.
Why does it show POST when my command has no -X?
curl sends a POST whenever a command has a body (-d, --json or -F) and no explicit method, and the parser follows the same rule. -G sends the data as a query string with GET instead, and -I sends HEAD.
Can it read files referenced with @, such as -d @body.json?
No. The parser runs in the browser and can't read files on your computer, so it shows the file name and a note. Paste the file's contents with --data-raw to see the body.
How exact is the generated code?
The method, URL, headers and body are the same, and the body is sent as the same string rather than being re-encoded. Some curl options have no equivalent: fetch can't skip certificate checks like -k, and browsers don't let fetch set a Cookie header. The generated code says so in a comment where it matters. The Python code passes allow_redirects=False unless the command has -L, because curl doesn't follow redirects by default.