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 option | axios config | Note |
|---|---|---|
| curl option-X, --request | axios configmethod | NoteDefaults to GET, or POST when a body is present |
| curl option-H, --header | axios configheaders | NoteHeader names keep their original casing |
| curl option-d, --data, --json | axios configdata | NoteJSON bodies keep the Content-Type header from the command |
| curl option-u, --user | axios configauth: { username, password } | NotePasswords are masked in the on-page report |
| curl option--max-time | axios configtimeout | NoteSeconds converted to milliseconds |
| curl option--compressed | axios configdropped | Noteaxios and fetch negotiate compression automatically |
| curl option--insecure, --proxy | axios confignot representable | NoteListed 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.comExpected 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.