Convert Curl to JavaScript Fetch
Convert curl commands into ready-to-run Python, JavaScript fetch, Node axios, PHP and Go code — locally in your browser.
Result
This page opens the converter with the fetch target preselected: paste a curl command and get a modern await fetch() call that runs unchanged in every browser and in Node.js 18+, where fetch is available globally without any dependency.
The generator maps curl flags onto the fetch options object: -X becomes method, -H entries fill headers, a JSON -d body is re-serialized as JSON.stringify over a real object literal (easier to edit than an escaped string), -u turns into an Authorization: Basic header built with btoa(), and -F fields become FormData appends. The snippet finishes by reading the response as json() or text() depending on the declared content type.
One thing the converter cannot change: the browser's same-origin policy. A request that works from curl may be blocked by CORS when sent from a web page — that is a server-side header issue, not a bug in the code. When calling third-party APIs from front-end code, remember the API key inside the snippet becomes visible to every visitor; keep secret keys on a backend and proxy the call.