cURL ↔ Fetch Converter
Convert cURL commands to fetch() and back.
cURL command
fetch() call
Handles common flags: method (-X), headers (-H), body (-d/--data), and basic auth (-u). Uncommon flags are ignored.
About this tool
Paste a cURL command to get an equivalent JavaScript fetch() call, including method, headers, and request body. Reverse the direction to turn a fetch() call back into a copy-paste cURL command.
How to use
- Paste a cURL command (or a fetch call in the other direction).
- The equivalent fetch() / cURL is generated instantly.
- Copy the result into your code or terminal.
Examples
cURL
curl -X POST https://api.example.com -H 'Content-Type: application/json' -d '{"a":1}'Frequently asked questions
Common ones: -X/--request, -H/--header, -d/--data, --data-raw, and -u/--user. Uncommon flags are ignored.