cURL to Fetch Converter
Parse a common curl command and generate equivalent browser / Node fetch() code using async/await — methods, headers, JSON bodies, cookies and basic auth included.
Paste your curl command
How it works
- Tokenizes the command, respecting single and double quotes
- Extracts the URL, method, headers, data payload, cookies and basic-auth user
- Skips silent and common flags such as
-s,-S,-L,--compressedand-k - Emits an
async/awaitfetch()call with headers and an optional JSON body
About cURL to Fetch Converter
A browser tab cannot execute curl — it is a command-line tool — and hand-writing the equivalent fetch() call is easy to get wrong. This converter turns a curl command copied from docs or shell history into modern async/await fetch code you can paste straight into a script, a test, or the DevTools console.
The two differ in defaults: curl sends Content-Type: application/x-www-form-urlencoded for -d payloads, while fetch() sets no content type unless you add one; HTTP headers are case-insensitive, so the converter preserves the exact casing you typed. The mapping is not complete — options like --cookie-jar, TLS certificates (-k, --cacert) and retries have no fetch equivalent and are skipped.