cURL to Fetch
Convert a curl command into JavaScript fetch() code with method, headers, JSON body, form data and basic auth. Paste from DevTools or API docs. Runs locally.
Runs in your browser. Nothing is uploaded.
About cURL to Fetch
API docs and the browser's Copy as cURL menu give you a curl command, but your code needs fetch(). Paste the command and get equivalent JavaScript: the method, every -H header, -d or --data-raw bodies (pretty-printed when they're JSON), -F form fields and -u basic auth.
Multi-line commands with backslashes, Windows ^ continuations and quoted values are all understood. Your tokens never leave the page.
How to use cURL to Fetch
- Type or paste your text into the input box. Press Sample to see an example.
- Adjust the options. The result updates as you type.
- Copy the result, or press Use as input to chain another transformation.
Frequently asked questions
Which curl options are supported?
-X, -H, -d and its --data variants, -F, -u, -b cookies, -A user agent, -G and the URL. Flags that do not affect the request, such as -L, -s and -k, are skipped, and anything else unsupported is listed as a note.
Will the fetch code work in Node.js?
Yes. Node 18 and later include fetch globally.
Is cURL to Fetch free and private?
Yes. cURL to Fetch is completely free with no sign-up. Everything runs in your browser, so whatever you type or paste never leaves your device.