All tools

cURL to fetch converter

Paste a curl command and read back the fetch call it becomes. The conversion happens in this page, in your browser.

Your curl command

This runs in your browser. Nothing you paste or open is sent to us.

What each flag becomes

The method comes from -X or --request. Each -H or --header becomes an entry in the headers object. -d, --data and --data-raw become the body, and several of them are joined with an ampersand the way curl joins them. -u turns a user and password into an Authorization header encoded with btoa, and -b turns a cookie string into a Cookie header. A command that carries a body but names no method converts to a POST, because that is what curl sends.

Where fetch and curl differ

fetch follows redirects on its own, so -L has nothing to add. It cannot be told to skip certificate checks, so -k has no equivalent at all. Cookie is on the browser list of headers a page may not set, so a snippet that sets one only works outside a page: inside one, credentials: "include" sends the cookies the browser is already holding. Compression is negotiated for you, so --compressed is already what happens.

See the request that failed, not a description of it

Session Replay records the failing request, the response and the console line beside it, so the next person to look at a broken call already has the whole thing in front of them.