cURL to Fetch
Paste a cURL command and get equivalent JavaScript fetch() code. Parses URL, method, headers, request body, and common flags like -d, -H, -X, and --data-binary.
About cURL to Fetch
This tool parses a cURL command and produces equivalent JavaScript using the fetch() API. It handles the most common cURL flags: -X / --request for method, -H / --header for headers, -d / --data / --data-binary for the body, plus the URL.
Options
- Use async/await — Wraps the call in an
asyncfunction withawait, or uses.then()chains. - Send credentials — Sets
credentials: 'same-origin'or'include'for cookies.
How to use
- Copy a cURL command (e.g., from your browser's DevTools "Copy as cURL").
- Paste it into the input box.
- (Optional) Toggle async/await and credentials.
- Click Convert and copy the generated fetch code.
Frequently asked questions
Does it support $'...' ANSI-C quoted strings? Yes — the parser handles single quotes, double quotes, and ANSI-C quoted strings used by Chrome's "Copy as cURL".
What about -k / --insecure? fetch() always uses the browser's certificate store, so those flags are ignored (not applicable in browser context).
What about --cookie? Cookies are mapped to a Cookie request header in the generated code. You can also enable the Send credentials option for cookie jars.