Paste a cURL command and get a ready-to-use fetch() snippet. Runs entirely in your browser.
HTTP · cURL · JavaScript fetch
Turn API documentation cURL snippets into starter fetch() calls. Paste a command with headers and body flags; get JavaScript you can drop into the browser or Node — generated locally, not sent to our servers.
OpenAPI portals, Stripe-style docs, and support tickets almost always show HTTP examples as curl. Front-end engineers and many Node developers work in fetch or thin wrappers around it. Hand-translating -H headers, JSON bodies, and methods is tedious and error-prone — especially with escaped quotes and multiline \ continuations.
This tool parses common cURL shapes in your browser and emits a readable fetch(url, options) skeleton. It does not execute the request; it only generates code.
\ are fine).| cURL | Typical fetch mapping |
|---|---|
-X / --request | method |
-H / --header | headers object |
-d / --data / --data-raw | body string |
-u user:pass | Basic Authorization header |
-A / --user-agent | User-Agent header |
--url / positional URL | First argument to fetch |
Exotic options (certificate pinning, arbitrary --next chains, some multipart edge cases) may need manual cleanup. Treat output as a starting point.
curl -X POST 'https://api.example.com/v1/items' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"name":"widget","qty":3}'
Becomes a fetch call along the lines of:
fetch('https://api.example.com/v1/items', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
body: JSON.stringify({ name: 'widget', qty: 3 })
// or body as the raw string from -d, depending on conversion
});
Secrets: “Copy as cURL” from a logged-in browser session often includes cookies and bearer tokens. Generate code on a trusted machine, strip credentials before sharing snippets, and prefer env-based secrets in real apps.
cURL is not subject to browser CORS. A request that works in the terminal may fail from a web page unless the API sends the right Access-Control-* headers. For local experiments against third-party APIs, use a backend proxy or the API’s official SDK. See also the CORS Header Builder.
No. It only generates code. Use your app, a REST client, or the API Tester tool to send traffic.
No. Shell quoting is messy. Verify headers and body, especially multipart uploads and binary data.
Parsing is local. Still avoid pasting production secrets on shared computers. Privacy Policy.