Skip to content
Shrake DevTools
  • JSON FormatterData & Format
  • JSON ValidatorData & Format
  • JSON MinifierData & Format
  • JSON ↔ YAML ConverterData & Format
  • XML FormatterData & Format
  • Base64 Encoder / DecoderData & Format
  • URL Encoder / DecoderData & Format
  • JWT InspectorData & Format
↑ ↓ to navigate↵ to openEsc to close

cURL → JavaScript

Runs locally in your browser. Your input is not uploaded.Free, no sign-up

cURL command

JavaScript

Convert cURL commands to JavaScript fetch() code.

How to use the cURL to JavaScript converter

  1. Paste a curl command, or click Sample.
  2. Copy the fetch() code. It runs in browsers, Node.js 18+, Deno and Bun.

What's translated

  • JSON bodies become JSON.stringify({…}) of a readable object; other bodies stay strings.
  • -u becomes a Basic Authorization header, -F a FormData upload, and --max-time an AbortSignal.timeout().
  • Headers browsers won't let scripts set, like Cookie and User-Agent, get a comment: Node.js sends them, browsers don't.

Frequently asked questions

Why does the code use await at the top level?

It's allowed in ES modules (.mjs files, <script type="module">) and the browser console. Elsewhere, wrap it in an async function.

Which cURL options are understood?

The ones that shape a request: -X, -H, -d and its variants (--data-raw, --data-binary, --data-urlencode, --json), -F, -u, -b, -A, -e, -G, -I, -L, -k and --max-time. Output options like -s or -o are ignored, and anything else is listed under the result.

Can I paste "Copy as cURL" from the browser?

Yes, in bash or Windows format: $'…' quoting and \, ^ or ` line continuations are handled. Remove session cookies and tokens you don't want in your code.

Is my command uploaded or run?

No. It's parsed and converted in your browser; nothing is sent.