⭐ 0

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.

Processed entirely in your browser — nothing you enter here is ever uploaded.

Processing... 0%

Result

About this tool

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.

Example. The command curl https://example.com in the fetch target becomes a fetch GET call to that URL.

Limit. Parsed flags are the request, header, data, user, form, json, cookie, user-agent, referer and output family; retry, proxy and insecure-TLS flags are not translated.