cURL to Fetch Converter
Paste a curl command — copied from your terminal or from "Copy as cURL" in browser dev tools — and get equivalent JavaScript fetch() code.
curl command
JavaScript fetch()
fetch("https://example.com", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: "{\"email\":\"you@example.com\",\"password\":\"secret\"}"
})
.then((res) => res.json())
.then((data) => console.log(data));Your files are processed in your browser and never uploaded to any server.
How to use this tool
- 1Paste your curl command.
- 2The equivalent fetch() code appears automatically on the right.
- 3Copy it directly into your project.
Frequently asked questions
Does it support every curl flag?+
It covers the most common flags: -X (method), -H (headers), and -d/--data (body). Highly unusual flags may not be parsed.
Browser dev tools let you copy any network request as a curl command, but most frontend code needs that same request expressed as fetch(). This tool parses the URL, HTTP method, headers, and request body out of a curl command and generates working fetch() JavaScript you can paste straight into your code, saving the tedious manual translation every time you need to reproduce a request from the Network tab.