cURL to Fetch
Convert cURL commands to JavaScript fetch code instantly. Supports headers, auth, JSON bodies, form data, and all HTTP methods.
Processed locally in your browser — nothing is uploaded.
0 characters
JavaScript fetch
Output appears here…About cURL to Fetch
Paste any cURL command — copied from browser DevTools, API docs, or a teammate — and get equivalent JavaScript fetch code. The converter understands methods, headers, basic auth, JSON bodies, URL-encoded form data, multipart form data, and query parameters.
cURL commands use shell quoting, so the converter includes a real shell-style tokenizer: single quotes, double quotes, escapes, and line continuations all work the way they do in your terminal.
Common uses
- Turn a “copy as cURL” from Chrome DevTools into frontend code
- Convert API documentation examples into working fetch calls
- Migrate shell scripts or Postman exports to JavaScript
Example
Input
curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{"name":"Ada"}'Output
const response = await fetch("https://api.example.com/users", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "Ada" }),
});Limitations
- Options with no fetch equivalent (like --compressed or --insecure) are reported but skipped
- File uploads with @file references generate placeholder code you must adapt