fixtdoc

curl to Fetch

Paste a curl command and get the equivalent fetch() code: method, headers, JSON or raw body, and basic auth, ready to drop into your project.

Files stay on your device

0 characters

fetch() code

Everything runs in your browser. Your text is not uploaded for processing and never leaves this device.

Frequently asked questions

Which curl flags are understood?

The ones that matter for fetch: -X/--request, -H/--header, -d and the other --data variants, --data-urlencode, -u/--user for basic auth, -b/--cookie, -A/--user-agent, -e/--referer, and --url. Flags with no fetch equivalent, like -k or --compressed, are skipped.

What happens to a JSON body?

If the body parses as JSON, the output uses JSON.stringify with the object pretty printed, so you can edit values in code instead of editing an escaped string. Other bodies are emitted as plain strings.

Is my curl command sent anywhere?

No, and that matters: curl commands often contain API keys and tokens. Parsing happens in your browser and the command is never sent anywhere or stored.