cURL to Fetch / Axios Converter

Paste a curl command — the kind copied from API docs, Postman, or Chrome DevTools — and get ready-to-paste JavaScript. Runs entirely in your browser.

curl command

paste here

JavaScript

Why this tool?

Every API vendor's documentation uses curl examples — it's the lingua franca of HTTP. But when you're writing a Node.js backend or a React app, you need that request in your language of choice: fetch, axios, or Node's built-in modules. Translating headers, method, body, and auth by hand is tedious and error-prone; an unescaped quote is enough to break a copy-paste.

What's supported

  • URL & method-X / --request, defaults to GET (or POST if -d is present).
  • Headers — repeatable -H / --header.
  • Body-d, --data, --data-raw, --data-binary, --data-urlencode. JSON bodies are kept as-is; form strings are detected and emitted accordingly.
  • Basic auth-u user:pass / --user becomes an Authorization: Basic header.
  • Cookies-b / --cookie become a Cookie header (works in Node; browsers ignore this for security).
  • Multipart form-F / --form generates FormData code.
  • GET with body-G converts -d pairs into a query string.
  • Line continuations — multi-line curl with trailing \ is normalised first.

Fetch vs Axios vs Node

Fetch is native in every modern browser and in Node 18+. It's the right default for new code. The downsides: non-2xx responses don't throw by default, timeouts need AbortController, and there's no built-in JSON body helper (you still call .json()). Axios is a popular third-party library that wraps XHR / Node's http module. It auto-parses JSON, throws on non-2xx, handles timeouts cleanly, and runs in legacy Node and IE. Node https is the low-level primitive — useful when you need streaming, proxies, or full control over TLS options.

Privacy

The entire conversion happens in your browser. No request is ever made to the URL in your curl command (this tool only generates code — it does not execute it). Nothing is logged or transmitted.

Related tools