cURL →JavaScript fetch()

Paste any cURL command and get clean JavaScript fetch() code. Also generates axios and got syntax.

Supports: -X (method), -H (headers), -d/--data (body), -u (basic auth), --data-raw, --data-binary

🟢📖 Why Convert cURL to fetch()?

cURL is the universal language of API documentation —every REST API docs page includes cURL examples. But frontend developers need to translate those into JavaScript fetch() calls.

This converter parses the cURL command and generates equivalent JavaScript code. It handles:

  • HTTP methods (GET, POST, PUT, DELETE, PATCH)
  • Headers (-H flag), including Content-Type and Authorization
  • Request body (-d, --data, --data-raw, --data-binary)
  • Basic Auth (-u user:pass) —generates base64-encoded Authorization header
  • URL query parameters embedded in the URL

fetch() is the modern standard for HTTP requests in the browser and Node.js 18+. axios is the most popular third-party HTTP client. got is a lightweight Node.js alternative.