toolqik

59 · API & Webhooks

cURL to Axios Converter

Turn any curl command into an Axios request.

Runs in your browser
Axios

  

About this tool

Axios is one of the most popular HTTP clients for JavaScript, in both Node.js and the browser. This converter turns a curl command into an Axios request config: method, URL, headers, data (JSON bodies become JavaScript objects, which Axios serialises for you), auth for Basic credentials and FormData for multipart uploads.

Supported curl options

-X, -H, -d / --data / --data-raw / --data-binary / --data-urlencode, --json, -F (multipart), -u (Basic auth), -b (cookies), -A, -e, -G, -I, -L, -k and combined flags like -sSL. Bash quoting, $'…' strings and line continuations work, and so does Chrome DevTools’ “Copy as cURL (cmd)” output for Windows. Options without an equivalent, like -o or -v, are listed so nothing is silently lost.

Copy a request from the browser: open DevTools → Network, right-click a request → Copy → Copy as cURL, and paste it here.

Axios behaviour to know

  • Errors: unlike fetch, Axios rejects for HTTP status codes outside 2xx. Read error.response.status and error.response.data in a catch block.
  • Redirects: in Node.js Axios follows them; the generated code sets maxRedirects: 0 to match curl without -L. Browsers always follow redirects.
  • JSON: objects in data are sent as JSON with the right Content-Type, and JSON responses are parsed into response.data.

FAQ

How do I convert curl to Axios?

Paste the curl command above; the Axios code appears instantly. Install Axios with npm install axios.

How does Axios handle Basic auth from curl -u?

It becomes the auth option, { username, password }, which Axios turns into the Authorization header.

Axios or fetch?

Both work. Axios adds automatic JSON handling, interceptors and error rejection for HTTP errors; fetch is built in and needs no dependency.

esc
↑↓ navigate↵ open