cURL to fetch() Converter

Paste a terminal curl command and get browser-ready JavaScript fetch() code with method, headers, body, credentials, and formatting helpers.

Input cURL Command

Supports common flags like -X, -H, -d, --data-raw, -u, -b, --compressed, and URLs.

What this converter does well

  • Turns common cURL syntax into readable JS.
  • Auto-detects method from -X and data flags.
  • Parses headers, cookies, basic auth, and request body.
  • Pretty-prints JSON bodies when possible.

Notes

  • Browser fetch cannot reproduce every terminal/network detail.
  • Some flags like TLS certs, proxies, and upload binaries need manual follow-up.
  • Credentials behavior depends on cookies and CORS policy.
Developer tool Self-contained Mobile-friendly

Generated JavaScript

Readable output you can drop into browser code, demos, extensions, or docs.

// Your generated fetch() code will appear here.
Tip: if your cURL command includes JSON, this tool will format it into a readable body string.
Copied