cURL ↔ Fetch Converter

Convert cURL commands to fetch() and back.

cURL command
fetch() call

Handles common flags: method (-X), headers (-H), body (-d/--data), and basic auth (-u). Uncommon flags are ignored.

About this tool

Paste a cURL command to get an equivalent JavaScript fetch() call, including method, headers, and request body. Reverse the direction to turn a fetch() call back into a copy-paste cURL command.

How to use

  1. Paste a cURL command (or a fetch call in the other direction).
  2. The equivalent fetch() / cURL is generated instantly.
  3. Copy the result into your code or terminal.

Examples

cURL
curl -X POST https://api.example.com -H 'Content-Type: application/json' -d '{"a":1}'

Frequently asked questions

Common ones: -X/--request, -H/--header, -d/--data, --data-raw, and -u/--user. Uncommon flags are ignored.
Contact

Let’s connect

Have a Liferay or Backend project you’d like to talk through? Fill in the form and I’ll get back to you.

Book Calendar