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.
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.