background image

Free Developer Tool - runs 100% in your browser

cURL to Fetch

Scroll down to learn more about this tool

Convert cURL commands to JavaScript fetch

API docs, browser DevTools ("Copy as cURL") and tools like Postman all hand you cURL commands - but your frontend or Node.js code needs fetch(). This converter parses the curl command and generates clean, modern async/await fetch code with the method, headers, body, credentials and basic auth carried over.

Supported cURL options

  • -X / --request - HTTP method (GET, POST, PUT, PATCH, DELETE…).
  • -H / --header - any number of request headers.
  • -d / --data / --data-raw / --data-binary - request body (JSON bodies are pretty-printed).
  • -F / --form - multipart form data via FormData.
  • -u / --user - Basic authentication, converted to an Authorization header.
  • -b / --cookie - cookies, sent via the Cookie header.

From DevTools to working code in seconds

  1. In Chrome or Firefox DevTools, open the Network tab, right-click a request and choose Copy → Copy as cURL.
  2. Paste the command above and click Convert.
  3. Copy the generated fetch code into your project and refactor the token/URL into config.

The conversion runs entirely in your browser - commands containing API keys and session cookies never leave your machine (still, rotate any secrets you paste anywhere). Decoding the Bearer token you just pasted? Use the JWT decoder.

More free developer tools