Free, browser-based utilities for everyday developer workflows

Convert cURL to Axios

Convert a cURL command into an Axios request, with the body and headers placed in the right arguments — a common source of bugs when writing Axios by hand.

Open this example in cURL Converter

Open the tool, then paste the sample input below. Everything runs locally in your browser.

Open this example in cURL Converter →

The problem

With Axios, post and put take the data as the second argument and the config (including headers) as the third. Hand-translating cURL often puts headers in the wrong position. The converter handles the argument order for you.

Sample input

cURL
curl -X PUT https://api.example.com/users/101 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer example_token" \
  -d '{"status":"active"}'

Expected output

Axios
await axios.put(
  "https://api.example.com/users/101",
  {
    status: "active"
  },
  {
    headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer example_token"
    }
  }
);

The body is the second argument; headers go in the config object as the third argument. Axios serializes the plain object to JSON automatically.

How to do it

  1. Paste the cURL command.
  2. Select Axios output if supported.
  3. Check the method, URL, headers, and payload.
  4. Copy the Axios snippet.
  5. Replace example values with real ones in a safe environment.

Common mistakes

  • Passing headers as the second argument of post/put instead of in the config.
  • Manually stringifying a body that Axios already serializes.
  • Mixing data and params (body vs query string).
  • Losing the Authorization header.
  • Using browser-side Axios with secret API keys.

Related tools

Related guides

FAQ

How do I convert cURL to Axios?

Paste the cURL command and select Axios output. The converter maps method, URL, headers, and body into the correct Axios call.

Where do headers go in Axios?

In the config object: the last argument for post/put, or the second argument for get/delete, as { headers: { ... } }.

How do I send query parameters with Axios?

Use the params option in the config, e.g. { params: { status: "active" } }, rather than putting them in the body.

Is Axios different from fetch?

Yes. Axios auto-serializes JSON, throws on HTTP error statuses, and has interceptors; fetch is lower-level and only rejects on network failure.

Why does my Axios request fail in the browser?

Often CORS, a wrong base URL, or sending secrets that the API rejects. Check the network tab and the server's CORS headers.

The cURL command is parsed locally in your browser. Nothing is sent to a server.