cURL to JavaScript

Paste a cURL command and convert it to fetch() JavaScript in the browser. Headers, JSON bodies, and HTTP methods are mapped so you can drop the snippet into a page or Node script.

cURL to: Java JavaScript Python PHP C# Go

About cURL to JavaScript

Convert a cURL command to JavaScript online and get a fetch() snippet with method, headers, and body. This free cURL to JavaScript converter is for moving a DevTools copy as cURL into frontend or Node code without rewriting the call by hand.

JSON bodies are emitted with JSON.stringify of an object literal when the payload looks like JSON. Other bodies stay as strings. Custom methods from -X and headers from -H are preserved. User-Agent, Cookie, and Referer flags become headers.

Use it when a backend teammate sends cURL and you need a browser call, or when you want a starting point for an integration test. Switch to Python, PHP, or Go from the language row if the next consumer is not JavaScript.

The conversion is local. Tokens in Authorization headers stay in the tab. Use this free cURL to fetch converter whenever you need JavaScript from a cURL command.