cURL to JavaScript Fetch Converter
Convert cURL commands to JavaScript fetch() code. Paste from DevTools or Postman and get runnable code.
cURL command
Paste a cURL command (e.g. from DevTools or Postman)
Try an example
Click to load a sample cURL command
Key Features
Turn any cURL command into clean fetch() code for browser or Node.js.
Paste any cURL
Paste cURL from browser DevTools, Postman, or the command line. GET, POST, headers, and JSON body supported.
JavaScript fetch()
Get clean, runnable fetch() code for browser or Node.js. Headers, method, and body are preserved.
One-click convert
Convert in one click. Copy the result into your project or run it in the console.
Copy to clipboard
Copy the generated fetch code with one click for quick use in your app.
Basic auth support
cURL -u user:pass is converted to fetch() with an Authorization: Basic header.
API and DevTools friendly
Ideal for converting network requests from Chrome DevTools or API docs into fetch code.
How to Use
Simple 4-step process
Step 1
Copy a cURL command (e.g. from Chrome DevTools → Network → right‑click request → Copy as cURL).
Step 2
Paste it into the cURL input box and click Convert to Fetch.
Step 3
Review the generated JavaScript fetch() code.
Step 4
Copy the code and paste it into your project or run it in the browser console.
Frequently Asked Questions
Everything you need to know about this tool and how it works.
See Full FAQIn Chrome or Edge: open DevTools (F12) → Network tab → perform the request → right‑click the request → Copy → Copy as cURL. In Firefox: same steps, then Copy as cURL. Postman and other API tools also offer “Copy as cURL”.
It supports the most common options: -X/--request, -H/--header, -d/--data, -u/--user (Basic auth), -G/--get, and --url. Options like -k (insecure) or --compressed are not reflected in the fetch output.
Yes. In Node.js 18+ the native fetch is available. For older Node, use a polyfill (e.g. node-fetch) or run the code in the browser.
Ensure the command starts with curl and includes a valid URL (e.g. https://...). Multi-line cURL is supported. If it still fails, simplify the command to the minimal form (e.g. curl 'https://api.example.com') and add options back one by one.
Still have questions?
Can't find what you're looking for? We're here to help you get the answers you need.