cURL to Fetch & Axios Converter – Convert cURL Commands to JavaScript Online

Paste any cURL command — for example one copied from Chrome DevTools with “Copy as cURL” — and get clean, ready-to-run JavaScript: both a modern fetch version (async/await) and an Axios version. Method, headers, cookies, JSON bodies and form data are all converted for you, in your browser. Nothing is uploaded.

fetch (async / await)


Axios


🔒 100% private: your cURL commands often contain live tokens — they are parsed locally and never leave your browser.

Why convert cURL to fetch or Axios?

cURL is how developers test APIs from the terminal, and Chrome DevTools will happily copy any network request “as cURL”. But when the request works in the terminal, the next step is using it in real code — and hand-translating flags into JavaScript is slow and error-prone. Quoting, JSON bodies, cookies and headers all have to land in exactly the right places. This converter does the translation mechanically and shows its work, so you can paste the result into your project and adjust from there.

What is converted

cURLJavaScript equivalent
URL and query stringfetch(url) / axios url
-X POST (or implied by -d)method
-H 'Name: Value'headers object
-d / --data-raw with JSONJSON.stringify({...}) for fetch, plain object for Axios
-F name=valueFormData with append() calls
-b 'a=b; c=d'Cookie header
-u user:passwordAuthorization: Basic … header
-A / -eUser-Agent / Referer headers

Flags with no browser equivalent (like --insecure or --compressed) are reported as notes instead of being silently dropped.

How to get a cURL command from your browser

  1. Open the page that makes the request and press F12 for DevTools.
  2. Go to the Network tab and trigger the request.
  3. Right-click the request → Copy → Copy as cURL.
  4. Paste it above and convert. Remember the copied command contains your real session cookies and tokens — fine here, because nothing leaves your browser, but do not post raw commands publicly.

Features

  • Both outputs — fetch (async/await, no dependency) and Axios config, side by side.
  • Real shell parsing — single and double quotes, escapes and line continuations are tokenized like a shell, so DevTools output parses correctly.
  • Smart JSON bodies — JSON payloads become real objects (pretty-printed) instead of escaped strings.
  • Notes, not silence — unsupported flags and file-based bodies are called out explicitly.
  • Private by design — cURL commands carry live credentials; conversion is local-only.
  • Free, no sign-up.

Related developer tools

Also in this section: the JWT decoder & verifier, the HAR file sanitizer, the SRT to WebVTT converter and the VCF to CSV converter. More tools are being added one by one.

Frequently asked questions

Is this cURL converter free?

Yes. It is completely free with no sign-up, and the conversion runs entirely in your browser.

Is my cURL command uploaded anywhere?

No. cURL commands usually contain Authorization headers and session cookies, so this tool is built to work 100% locally — parsing and code generation happen in your browser tab.

Does it support Windows (cmd) cURL commands?

DevTools on Windows can copy as cURL (POSIX) or cURL (cmd). The POSIX variant, with single quotes and backslash continuations, is fully supported. The cmd variant uses double quotes and carets; most simple commands convert, but POSIX output is recommended.

What happens to file uploads (-F file=@path)?

They become FormData append calls with a placeholder for the file input, because a browser cannot read an arbitrary path from your disk. Point the placeholder at an <input type="file"> in your page.

Why does the fetch version use JSON.stringify but Axios does not?

fetch sends exactly the string you give it, so objects must be stringified. Axios serializes plain objects to JSON automatically when the Content-Type is JSON, so the Axios output passes the object directly.

Is this cURL converter free?

Yes. It is completely free with no sign-up, and the conversion runs entirely in your browser.

Is my cURL command uploaded anywhere?

No. cURL commands usually contain Authorization headers and session cookies, so this tool is built to work 100% locally — parsing and code generation happen in your browser tab.

Does it support Windows (cmd) cURL commands?

DevTools on Windows can copy as cURL (POSIX) or cURL (cmd). The POSIX variant, with single quotes and backslash continuations, is fully supported. The cmd variant uses double quotes and carets; most simple commands convert, but POSIX output is recommended.

What happens to file uploads (-F file=@path)?

They become FormData append calls with a placeholder for the file input, because a browser cannot read an arbitrary path from your disk. Point the placeholder at an <input type="file"> in your page.

Why does the fetch version use JSON.stringify but Axios does not?

fetch sends exactly the string you give it, so objects must be stringified. Axios serializes plain objects to JSON automatically when the Content-Type is JSON, so the Axios output passes the object directly.

Scroll to Top