cURL Converter — cURL to fetch, Python, Go, PHP
Convert cURL commands to JavaScript fetch, Node, Python requests, Go, PHP and axios. See method, query, headers, cookies and body parsed. Runs in your browser.
Request
Query parameters
- expand
- items
- limit
- 20
Headers
- Content-Type
- application/json
- Authorization
- Bearer demo_7f3a9c2e41
Cookies
- session
- 7d1f0c
- theme
- dark
Body
{
"customer": "cus_42",
"items": [
{
"sku": "KB-75",
"qty": 1
}
],
"note": "It's a gift"
}Options
// Browsers drop forbidden headers (Cookie, Host, Referer…).
// For cookies, use credentials: "include" instead.
// Browser manual redirects return an opaque response; the 3xx status and body are unavailable.
const response = await fetch("https://api.example.com/v1/orders?expand=items&limit=20", {
redirect: "manual",
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer demo_7f3a9c2e41",
"Cookie": "session=7d1f0c; theme=dark"
},
body: JSON.stringify({
"customer": "cus_42",
"items": [
{
"sku": "KB-75",
"qty": 1
}
],
"note": "It's a gift"
})
});
console.log(response.status, await response.text());POST · 25 lines · warnings: 0Nothing is sent
Runs in your browser. The command is parsed, never executed, and no request is made.
How to use
- Paste a cURL command, for example from your browser's DevTools (Network › Copy › Copy as cURL), or try an example.
- Read the parsed request: method, URL, query parameters, headers, cookies, authentication and the body, pretty-printed when it is JSON or a form.
- Pick fetch, Node.js, Python, Go, PHP or axios and copy the generated code.
Example
curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{"name":"Ada"}'Details and limitations
The command is only read, never run: nothing is sent to the URL or to any server. Quotes, $'…' strings, backslash line continuations and the Windows cmd ^ format are understood like a shell would, without expanding variables.
Supported options include -X, -H, -d, --data-raw, --data-binary, --data-urlencode, --json, -F, -u, -b, -A, -e, -I, -G, -k, -L, -m and --url. Anything else is listed as a warning, and files referenced with @ become placeholders.
FAQ
Why does the fetch code mention forbidden headers?
Browsers do not let scripts set headers such as Cookie, Host or Referer, so fetch silently drops them. The Node.js version sends them as written.
What happens to -d @file or -F file=@photo.jpg?
The page cannot read files from your disk, so data files become a placeholder and uploads become a file reference in each language, for example open() in Python or os.Open in Go.
Is it safe to paste commands with tokens?
The conversion happens entirely in your browser and nothing is stored or sent. Still, rotate any credential you have shared anywhere you do not control.
Related tools
Format references
Tool page updated: