Skip to content
Utiloom

cURL to Fetch & Axios Converter

Convert bounded curl commands into runnable fetch or axios code with explicit handling for every unsupported or non-representable option.

LocalNo command retention

Reviewed July 17, 2026

Guide, examples, and validation Show

About this tool

Turn a copied curl command into JavaScript request code without guessing what was silently dropped along the way.

  • Tokenizes single quotes, double quotes, ANSI-C quoting, escapes, line continuations, and comments, and stops with a clear error on pipes, redirections, command substitution, and unrecognized options.
  • Converts method, URL, headers, JSON, URL-encoded, raw, and multipart bodies, --data-urlencode, -G query promotion, basic auth, cookies, and --max-time timeouts into fetch and axios code.
  • Lists every dropped or browser-restricted option as an explicit note, flags unexpanded shell variables, and exports a versioned JSON report with the Authorization value redacted.

How to use cURL Converter

Paste a single curl command, convert it, review the parsed method, URL, headers, and notes, then copy the fetch or axios code or download the JSON report.

When this tool is useful

  • Porting a copied API example or DevTools 'Copy as cURL' command into application code.
  • Reviewing exactly which curl options survive a JavaScript translation before debugging a request.

Practical tips

  • Replace shell variables and @file references with literal values before converting.
  • Read every note: dropped options such as --insecure or --retry change behavior even though the code runs.

Convert cURL to Axios

After converting, open the axios tab to get an axios(config) call built from the same parsed request as the fetch output. The method, URL, and headers map one to one; -d and --data bodies become the data field, --user becomes the auth object with username and password, and --max-time becomes timeout in milliseconds. Query strings stay inside the URL exactly as written so the request reaches the server the way the original command did.

curl optionaxios configNote
curl option-X, --requestaxios configmethodNoteDefaults to GET, or POST when a body is present
curl option-H, --headeraxios configheadersNoteHeader names keep their original casing
curl option-d, --data, --jsonaxios configdataNoteJSON bodies keep the Content-Type header from the command
curl option-u, --useraxios configauth: { username, password }NotePasswords are masked in the on-page report
curl option--max-timeaxios configtimeoutNoteSeconds converted to milliseconds
curl option--compressedaxios configdroppedNoteaxios and fetch negotiate compression automatically
curl option--insecure, --proxyaxios confignot representableNoteListed as notes so nothing is silently lost

Convert cURL to fetch

The fetch tab renders the same request as a native fetch() call with an init object, so you can choose the client per project without re-converting. Both outputs come from one parser, and every option that fetch or axios cannot express is listed under the code as an explicit note.

Examples you can test

Load an example, compare the result with the expected output, then replace it with your own input.

Convert a JSON POST

Example input

curl -X POST -H 'Content-Type: application/json' -d '{"a":1}' https://api.example.com

Expected output

fetch call with JSON.stringify body plus an axios equivalent

CORS and authentication on the target server still apply when the code runs in a browser.

Validation checklist

  • Confirm the parsed method, URL, and headers match the original command.
  • Resolve every warning note before running the code.
  • Remove embedded credentials before committing generated code.

Frequently asked questions

Which curl options are supported?

Common request options: -X, -H, -d and its --data variants, --data-urlencode, --json, -F, -G, -I, -u, -b with literal pairs, -A, -e, -L, -m, --url, and no-op flags such as -s and -v. Anything else stops the conversion with a named error instead of being ignored.

What happens to options fetch cannot express?

Options such as --insecure, --proxy, --retry, and --compressed are dropped and each one is reported as an explicit note, so the generated code never silently diverges from the original command.

Why does a command with @file or $(...) fail?

Reading local files and running shell substitutions cannot be reproduced by generated JavaScript. The converter asks you to paste literal content instead of emitting code that behaves differently.

Is the generated code safe to run in a browser?

The code is standard fetch or axios. Notes flag headers such as Cookie, User-Agent, and Referer that browsers restrict, and CORS on the target server still applies.

Are commands or credentials uploaded?

No. Parsing and code generation run locally. Credentials from --user appear in the generated code so it works, and the downloadable JSON report redacts the Authorization value.

Related tools

Keep the workflow moving

Continue with tools that handle a related input, output, or validation step.

Developer

CSS Formatter

Format CSS, SCSS, or Less with stable output verification.

Local
Developer

HTML Entity Encoder Decoder

Transform HTML5 character references with explicit context and error policy.

Local
Developer

HTML Formatter

Format HTML with explicit whitespace and embedded-code policies.

Local
Developer

HTML to Markdown Converter

Convert HTML body content into safe, policy-driven Markdown.

Local