Skip to content

cURL to fetch converter

Right-click a request in DevTools → Copy → Copy as cURL, paste it here and get the code.

cURL → fetch

What does it do?

It turns a cURL command into ready-to-use code for fetch, axios or Angular HttpClient: method, URL, headers, JSON or form bodies, multipart uploads and basic authentication.

It is the fastest way to reproduce in your frontend a request you saw in DevTools, Postman or an API's documentation.

Supported options

OptionMeaning
-X, --requestHTTP method
-H, --headerheader
-d, --data, --data-raw, --data-binaryrequest body
--jsonJSON body with its Content-Type and Accept
-F, --formmultipart form field or file
-u, --userbasic authentication
-b, --cookiecookies
-Gsend the data as query string

Example output

const response = await fetch("https://api.example.com/v1/orders", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ "productId": 42 }),
});
const data = await response.json();

Frequently asked questions

›How do I copy a request as cURL?

Open DevTools, go to the Network tab, right-click the request and choose Copy → Copy as cURL. Both the bash and the cmd (Windows) versions are supported.

›Are cookies and tokens sent anywhere?

No. The command is parsed and converted in your browser; nothing is executed or uploaded. Still, remember that a copied request contains your session cookies and Authorization header.

›Why is there no Content-Type with -F forms?

Because FormData sets the multipart Content-Type itself, including the boundary. Setting it by hand would break the request.