cURL to Axios Converter — Online & Zero-Upload
Turn any cURL command into a tidy axios.request() call: lowercase method, headers object, data as a parsed object literal, and -u credentials mapped to axios's native auth option. The entire conversion runs in your browser — zero upload, zero logging.
Zero upload, ever
Parsing and code generation run in your browser — URLs, headers, and tokens never touch a server.
Live 100 ms conversion
Output updates as you type or paste, with one-keystroke copy via Cmd/Ctrl + Enter.
Config-object output
One declarative axios.request({...}) — easy to extend with interceptors and retries.
Paste a cURL command to convert
cURL command
Paste a cURL command — idiomatic code appears here instantly, converted entirely in your browser.
Technical documentation
How cURL maps to axios configuration
Each cURL flag has a natural home in the axios config: -X/--request becomes a lowercase method, -H flags populate headers, data flags become data, and the URL (with its query string preserved verbatim) becomes url. The result is one declarative axios.request() call you can read top to bottom.
When the body is JSON, it is parsed and embedded as a formatted object literal — axios serializes objects automatically and sets Content-Length for you, so the snippet stays clean. Non-JSON bodies are emitted as plain strings with their content type intact.
Basic auth the axios way
Instead of hand-building an Authorization header, -u user:pass is converted to axios's native auth: { username, password } option, which encodes and sets the header at request time — the idiomatic pattern most codebases prefer. If your command already includes an explicit Authorization header (a bearer token, for example), it is passed through untouched and the auth option is skipped to avoid conflicts.
Credentials embedded in the request URL, like https://user:[email protected]/, are extracted into the same auth option, leaving a clean URL in the generated config.
From snippet to production code
The output assumes a default axios instance; run npm install axios first if your project does not already depend on it. Because everything is a config object, it is trivial to lift into a shared instance: move method, url, headers, and data into axios.create() defaults, or attach the object to interceptors for auth refresh and retry logic.
The snippet logs response.data, which is the parsed body — axios handles JSON deserialization automatically, so there is no await response.json() step like in fetch-based code.
Semantics preserved from curl
The converter keeps curl's wire behavior: --data-urlencode values are percent-encoded before being placed in the body or query string, -G forces data into the URL query with a GET method, and repeated -d flags are joined with & exactly as curl joins them. Repeated headers collapse to the last value, matching curl's behavior.
Like curl, axios follows redirects for GET/HEAD by default; -k/--insecure and other TLS flags have no safe equivalent in the browser and are ignored. A GET with body data is converted to query parameters because servers and fetch-based runtimes reject GET bodies.
Frequently asked questions
Do I need to install anything to convert cURL to axios?
No. The converter itself is a static web page that runs in your browser. The generated snippet does assume the axios package in your project — npm install axios — since it emits axios.request() calls.
How is basic auth handled in the axios output?
The -u flag maps to axios's native auth: { username, password } option rather than a manually encoded header. Bearer tokens sent via -H 'Authorization: Bearer …' are kept as plain headers.
Why is the method lowercase in the generated code?
axios normalizes methods to lowercase internally, and the community style guide recommends lowercase verbs in config objects. The converter emits method: "post" style values for idiomatic consistency.
Does the axios output include TypeScript types?
The snippet is plain, type-checkable JavaScript that works unchanged in TypeScript. For typed responses, annotate with a generic such as axios.request<MyType>(config).
Is my cURL command uploaded anywhere?
No. Conversion is 100% client-side — the page is static HTML and JavaScript, and your command (including tokens and cookies) never leaves the browser.
Can I convert commands with query parameters?
Yes. Query strings are preserved exactly as pasted, and -G with data flags is merged into the URL the same way curl does it. --data-urlencode parts are percent-encoded for you.