Convert cURL to Fetch
Turn cURL commands into browser-ready fetch code for JavaScript apps.
Open cURL Converter with a ready-to-run example.
- You need to port a cURL command into frontend code.
- You are sharing API examples with a JS team.
- You want to quickly test headers and payloads with fetch.
- Paste the cURL command into the cURL Converter.
- Select fetch as the output target.
- Copy the generated snippet into your codebase.
- Include all headers (-H) so auth and content types are preserved.
- Use -d for JSON bodies and verify the generated JSON.stringify call.
- Remove line breaks or "\" if your shell added them.
POST with JSON body
curl -X POST https://api.example.com/v1/orders -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"sku":"ABC-1","qty":2}'
fetch("https://api.example.com/v1/orders", {
method: "POST",
headers: {
"Authorization": "Bearer $TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({ sku: "ABC-1", qty: 2 })
});
GET with query params
curl "https://api.example.com/v1/users?status=active&limit=50" -H "Accept: application/json"
fetch("https://api.example.com/v1/users?status=active&limit=50", {
method: "GET",
headers: {
"Accept": "application/json"
}
});
Yes. Headers in the cURL command are translated into fetch headers.
Yes. The converter supports multiple output targets including Axios.
No. The conversion runs locally in your browser. No uploads.
Paste it as-is; the converter handles typical line breaks.
Privacy-first: runs locally in your browser. No uploads.