Loading ToolDeck, please wait.

ToolDeck.online

INITIALIZING_

0%
DESIGNED BY SJ VISUAL FLOW STUDIOS
ToolDeck.onlineOpen. Build. Go.
Runs in your browser · Nothing sent to a server

curl to Axios Converter

Paste a curl command from any API doc and get clean, working Axios code instantly. One click switches to native fetch. Handles JSON, form data, file uploads, auth, headers, cookies and query params.

Try:

Paste a curl command on the left and the axios code will appear here.

Everything runs in your browser. Nothing is sent to a server.

Note: Axios sets Content-Type automatically for objects and FormData. If your curl command set a custom type, it is preserved above.

What people use it for

Copy code from API docs

Most APIs document requests as curl. Paste them here and get Axios or fetch code you can drop straight into a React, Next.js, or Node project. No more hand-translating -H, -d and -F flags.

Reproduce bug reports

When a customer files an issue with a curl command, convert it to Axios in one paste. You will see the exact request your app should send, with all headers, params and body fields laid out cleanly.

Learn Axios from real examples

If you are new to Axios or fetch, paste a curl command you already understand and see how the same request looks in JavaScript. The patterns become obvious after one or two conversions.

Migrate between libraries

Moving from curl scripts to Axios, or from Axios to native fetch? Convert in both directions with one tool, and copy the result without leaving the browser.

Why this converter is different

Most curl converters either upload your command to a server (bad if you paste a token) or only handle a subset of common flags. This tool parses locally, keeps your secrets private, and covers the flags you actually use in real API docs.

  • Everything runs in your browser

    Your curl command never leaves your device. There is no server, no upload, no log. Paste a token, paste a body, paste a secret header. Nothing is sent anywhere.

  • Covers the flags people actually use

    GET, POST, PUT, PATCH, DELETE, JSON bodies, url-encoded forms, multipart file uploads, basic auth, Bearer tokens, cookies, user agent and referer are all recognised and preserved.

  • Two outputs, one click

    Switch between Axios and native fetch with a single tap. Both are valid, modern JavaScript, ready to paste into any project with no extra dependency for fetch, and a single import line for axios.

  • Handles tricky input

    Multi-line curl commands, single quotes, double quotes, backslash escapes, --header=Key:Value form, --data-urlencode, and -G all parse correctly without manual cleanup.

ToolDeck vs other converters

Comparison of ToolDeck curl to Axios with other converters
FeatureToolDeckOther converters
Runs in browserYes, no uploadUploads curl to a server
Axios + fetch outputBoth, one clickOften just one
File upload supportYes, with FormDataPartial or none
Basic authYes, -u handledSometimes ignored
CostFree, no sign-upFreemium, limited
PrivacyYour tokens never leaveSent to their server

Every curl flag and what it becomes

Here is the exact mapping the converter uses. If your flag is on the left, it is handled on the right.

curl flags and their Axios or fetch equivalent
curl flagMeaningBecomes
-X, --requestHTTP methodmethod: "post"
-H, --headerRequest headerheaders: { "Key": "Value" }
-d, --dataRequest bodydata: { ... } or URLSearchParams
-F, --formMultipart form fieldFormData().append(...)
-u, --userBasic authauth: { username, password }
-b, --cookieCookie headerheaders: { Cookie: "..." }
-A, --user-agentUser agent headerheaders: { "User-Agent": "..." }
-G, --getMove body into queryparams: new URLSearchParams(...)

Not supported

Shell-only syntax like $(command) substitution, environment variables ($API_KEY), pipes, and reading file contents with @file.json cannot run in a browser. Replace shell variables with their values before pasting. For file uploads via -F, the generated code uses File objects that you provide from an <input type="file"> element.

Convert curl to Axios in 3 steps

  1. 1

    Copy a curl command

    Grab it from API docs, a bug report, or a terminal session. Multi-line commands are fine.

  2. 2

    Paste it into the tool

    The Axios code appears on the right instantly. Switch to the fetch tab if you prefer native fetch.

  3. 3

    Copy and paste into your code

    One click. The output is ready to use. For uploads, replace the file placeholder with your File object.

curl to Axios questions, answered

Is my curl command uploaded anywhere?

No. Everything runs inside your browser using JavaScript. The curl string is parsed locally, converted to code, and displayed. Nothing is sent to a server, so any tokens, cookies or secrets you paste are safe.

Which curl flags does this tool support?

The common ones: -X, -H, -d, --data-raw, --data-binary, --data-urlencode, -F, -u, -b, -A, -e, --url, -G, --compressed, -L, -k, -s, -v, and the --flag=value form. Flags that only affect curl output, like -o, --max-time, and --retry, are recognised and safely ignored.

Does it handle file uploads with -F?

Yes. It generates a FormData block and marks file fields with a comment telling you to replace the placeholder with your File object from an <input type="file"> element. Browser JavaScript cannot read local files from a curl path like @photo.jpg, so the placeholder is required.

What is the difference between Axios and fetch?

fetch is built into every modern browser and Node 18+, so no dependency is needed. It returns a Response you must parse manually. Axios is a small library with a nicer API, automatic JSON parsing, a timeout option, and file upload progress events. Both work well. Pick fetch for zero dependencies, Axios for convenience.

Does it support both Axios and native fetch output?

Yes. Use the tabs on the right to switch between the two. The Axios output includes the import line and an await-able call. The fetch output is complete with method, headers, body, and a await response.json() line.

Why does the output show a placeholder for file uploads?

Curl uses @filename to read a file from disk. A browser cannot read files from a path. Instead, the tool outputs form.append("file", file) and adds a comment telling you to supply the File object yourself, typically from a user-picked file in an <input type="file"> element.

What about basic auth with -u?

It is converted to auth: { username, password } for Axios. For fetch, the tool generates a Basic Authorization header, which is the same thing Axios does under the hood. Both are correct and work against any standard endpoint.

Does it work with shell variables or command substitution?

Not in a browser. Things like $(cat token.txt), $API_KEY, and pipes cannot run in JavaScript. If you have shell variables, replace them with their values before pasting.

Is there a file size limit?

No. The curl command is a string in memory. It can be a few characters or a few hundred lines, and it converts instantly.

Is it free?

Yes. Completely free. No sign-up, no daily limit, no ads inside the tool, no watermark on the output.

More free developer tools