---
title: "curl to JS: Convert curl to JavaScript fetch"
description: "Free curl to JS converter: paste a curl command, get fetch code for the browser or Node.js 18+, and see which headers and options fetch drops."
canonical: "https://browser-use.com/tools/curl-to-javascript"
last_updated: "2026-11-15"
---

# curl to JS: Convert curl to JavaScript fetch

## Free curl to JavaScript (fetch) Converter

Convert a curl command to JavaScript fetch code for the browser or Node.js. See which headers and options fetch cannot send before you run it.

## How it works

### Copy the request as cURL

In Chrome, Edge or Firefox DevTools, right-click a request in the Network panel and choose Copy as cURL. On Windows, pick the bash or POSIX version.

### Pick browser or Node

Browser code leaves out what a page cannot send and says why. Node code keeps your headers and reads -F files from disk.

### Run it

Copy or download it. Run browser code in the DevTools console or a module script. Node 18 and later have fetch built in; the .mjs file allows top-level await.

### What can a browser fetch not send?

Headers the Fetch standard forbids are dropped without an error: Cookie, Host, Referer, Origin, Accept-Encoding, Content-Length and any sec- or proxy- name. Chrome also replaces User-Agent (tested in Chrome 157). A request to another site needs that site's CORS permission.

Source: [Fetch standard: forbidden request headers](https://fetch.spec.whatwg.org/#forbidden-request-header) · [MDN: CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS)

### What happens to redirects?

curl follows redirects only with -L; fetch follows them by default. Without -L, Node code sets redirect: "manual" and returns the 3xx as curl does. Browser code keeps following, because there "manual" returns status 0 with no Location header.

Source: [MDN: RequestInit redirect](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#redirect)

### Which curl options are converted?

\-X, -H, -A, -e, -b, -u, -d, --data-raw, --data-binary, --data-urlencode, --json, -F, -G, -I, -L, -m, --url, --url-query and --oauth2-bearer. -k, -x and --digest have no fetch option and are flagged. JSON bodies are sent exactly as typed, so big numbers keep every digit.

### Is my command sent anywhere?

No. Conversion runs in this tab and the command is not sent to a server. Copied commands often carry session cookies and tokens, so treat the code like a password.

## Request blocked?

Browser Use cloud browsers run a maintained Chromium fork with residential proxies.

[See stealth browsers](https://browser-use.com/stealth-browsers)

curl command

Run in

BrowserNode.js 18+

Convert to JavaScriptLoad example

---

BROWSER USE

- Browser Use Agents: give Browser Use a task and receive completed work. API V4 is current for new integrations.
- Browser Infrastructure: connect your agent or automation to managed browsers through SDK, REST, or CDP. Starts at $0.06/browser-hour.
- Developer tools: Open Source, Browser Harness, SDK, and MCP support the two products above.

[Developer Index](https://browser-use.com/index.md)
[Product Map](https://browser-use.com/llms.txt)
[Full Product Context](https://browser-use.com/llms-full.txt)
[Pricing](https://browser-use.com/pricing.md)
[Cloud Docs](https://docs.browser-use.com/cloud/quickstart)
[Open Source Docs](https://docs.browser-use.com/open-source/introduction)
