Skip to content
Tools

cURL to Axios

Turn a cURL command into a JavaScript Axios request.

Local
JavaScript (Axios)

What this tool does

This tool turns a cURL command into an Axios request in JavaScript. Paste a command, including one copied from your browser devtools, and it writes the matching axios call with the method, URL, headers, query parameters and body.

How it maps to Axios

  • The method and URL go in the config object.
  • Headers go in headers; query parameters go in params.
  • A JSON body goes in data as an object; form data uses URLSearchParams.
  • Basic auth from -u becomes the auth option.

Good to know

The snippet uses top-level await, so run it in an async function or a module. It only reads the command and writes code in your browser; it never sends the request.

Frequently asked questions

Does it send the request?
No. It reads the cURL command and writes the Axios code in your browser. Nothing is sent.
How is the body handled?
JSON becomes a data object, form data uses URLSearchParams, and basic auth becomes the auth option.

Learning resources

Testsmith also runs hands-on courses and a free practice app for the skills behind this tool.

Feedback welcome

Found a bug in this tool, or want it to do something it does not? Tell us and we will take a look.