Text & code · runs locally
curl to fetch() converter
Paste a curl command, get a drop-in fetch() snippet — method, headers, body, auth and timeouts included.
How to use this tool
- 1Paste the curl command
Multi-line commands with backslashes, quoted strings and --flag=value forms all parse. Copy-paste straight from your terminal history or API docs.
- 2Review the translation
Flags become real fetch options: -d/--json become a body, -u becomes a Basic auth header, --max-time becomes AbortSignal.timeout. Untranslatable flags become commented warnings.
- 3Copy request.js
The snippet includes status checking and a .json() or .text() read based on your Content-Type header.
This page has no server behind it. Files are read, changed and re-built by your own browser — then they disappear when you close the tab. That's the whole privacy policy, applied.
Questions people actually ask
Which curl flags are supported?
-X/--request, -H/--header, -d/--data/--data-raw/--data-binary/--data-urlencode, --json, -u/--user, -A/--user-agent, -e/--referer, -b/--cookie, -L/--location, -I/--head, -G/--get, -o/--output, --max-time and --url. Anything else is dropped with a comment explaining why.
Why does -k become a comment instead of an option?
fetch has no “insecure TLS” switch — skipping certificate verification in a browser is not available, by design. The output tells you to fix the certificate rather than pretend the flag survived.