Zero Signup ToolsFree browser tools

Developer Tools

Fetch to cURL Converter

Paste a JavaScript fetch() or axios call and copy the equivalent curl command. POSIX, PowerShell, and Windows cmd shells supported.

Or load a preset

The fetch or axios snippet is parsed locally in your browser. Tokens, headers, auth values, and request bodies never leave your device.

What gets converted

URL and method
The first argument to fetch() becomes the curl URL. method maps to -X. A non-GET method is added explicitly so the command is reproducible.
Headers
Every entry in headers becomes a -H argument. Object literals, arrays of pairs, and new Headers() are all recognized.
JSON bodies
body: JSON.stringify({ ... }) normalizes through JSON.parse and JSON.stringify, and a Content-Type: application/json header is added when it is missing.
URLSearchParams and FormData
new URLSearchParams({ ... }) becomes a urlencoded body with the right Content-Type. FormData with .append calls becomes -F parts, with file values rendered as @filename placeholders you can edit.
axios calls
axios({ ... }) configs and shorthand methods like axios.get(url, options), axios.post(url, data, options) are recognized. Plain object data is serialized to JSON.
Shell flavor
Output is rendered for POSIX shells (Bash, Zsh, Git Bash, WSL), PowerShell, or legacy Windows cmd.exe, with the right line-continuation and quoting rules for each.

How to use

  1. Paste a fetch() or axios call into the input area on the left. The DevTools "Copy as fetch" output works as-is.
  2. Pick the target shell: POSIX (Bash, Zsh, Git Bash, WSL), PowerShell, or legacy Windows cmd.exe.
  3. Copy the multi-line curl command for readability, or the one-line version for chat, runbooks, and CI configuration.
  4. Use the preset buttons (GET, POST JSON, urlencoded login, DevTools copy, axios POST, axios.get shorthand, multipart FormData) to see how each pattern is converted.
  5. Read the warnings panel if any JS-only options (credentials, mode, referrerPolicy, plain object data passed to fetch) were detected so you understand what was ignored.

About this tool

Fetch to cURL Converter takes a JavaScript fetch() call (or an axios call, or a fetch literal copied from the Chrome or Firefox DevTools Network tab via the "Copy as fetch" menu) and rewrites it into the equivalent curl command you can paste into a terminal, a CI job, a Postman "Import curl" dialog, a bug report, or a runbook. The parser handles the inputs developers actually paste: fetch(url), fetch(url, options), await fetch(...), fetch(...).then(...), axios({ method, url, headers, data }), axios.get(url, options), axios.post(url, data, options), Node 18+ fetch, and the verbose DevTools copy that includes credentials, mode, referrer, and referrerPolicy. JS-only options that have no curl equivalent are flagged as informational notes rather than silently dropped, so the resulting command stays faithful to the request the browser would actually make. Headers are recognized whether they are passed as an object literal, an array of name-value pairs, or a new Headers(...) instance, and they are emitted as one -H per header in the order they were declared. JSON bodies passed via body: JSON.stringify({...}) are normalized through JSON.parse and JSON.stringify so a pretty-printed JS body becomes a compact curl body; a Content-Type: application/json header is added when missing. new URLSearchParams({...}) bodies become urlencoded --data-raw arguments with the right Content-Type, and FormData instances built with .append(name, value) statements above the fetch call are emitted as -F parts, with file values rendered as @filename placeholders you can edit before running. axios shorthand methods follow the library's documented argument order: axios.get and axios.delete take an options object after the URL, while axios.post, axios.put, and axios.patch take a data argument followed by an options argument. The output is rendered in three shell flavors with the correct quoting and continuation rules: POSIX shells (Bash, Zsh, Git Bash, WSL) use single-quoted arguments with the canonical close-quote-reopen-quote trick to embed single quotes safely, plus backslash newlines; PowerShell uses double-quoted strings with backtick escapes for backticks, double quotes, and dollar signs to defeat variable interpolation, plus backtick newlines; cmd.exe uses double-quoted arguments with doubled inner quotes and doubled percent signs, plus caret newlines. Both a multi-line, easy-to-read command and a single-line command are exposed with separate copy buttons, so you can pick whichever paste target you need. Useful for developers reproducing a request the browser made under DevTools in a terminal, support engineers turning a frontend repro into a runnable curl for a backend ticket, QA engineers grabbing a JS request and replaying it from a CI job, and anyone who wants the inverse of the existing Curl to Fetch converter. Everything runs in your browser; the fetch or axios snippet, headers, auth tokens, and request bodies never leave your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools