cURL to Fetch Converter

Convert a supported cURL request into Fetch code without executing the command.

Web & API
Preparing your workspace…

Input

Preparing your workspace…

Output
Your result will appear here.

How to use

  1. Paste one POSIX cURL command or load Sample.
  2. Inspect the generated Fetch call and compatibility notes.
  3. Copy the code or download request.js for review and use.

Translating a command into a browser request

A cURL command describes a request in a command-line environment. Fetch expresses similar request data in JavaScript, where browser policies may change what can be sent or read.

The converter extracts the supported request fields and generates code. It does not execute shell syntax, read local files or send the request during conversion.

Supported request data

Common method, header, text-data, JSON, data-urlencode, Basic-auth and Bearer options are supported. POSIX quoting is parsed as request input rather than passed to a shell.

Local-file bodies, multipart uploads, shell expressions and unknown flags are rejected so their omission cannot silently change the generated request.

Example
Input
curl --location 'https://httpbin.org/anything?source=devtoolsy' --header 'Content-Type: application/json' --data-raw '{"message":"Hello, API!","active":true}'
Result
fetch("https://httpbin.org/anything?source=devtoolsy", {method: "POST", headers: {"Content-Type": "application/json"}, body: "{\"message\":\"Hello, API!\",\"active\":true}", credentials: "omit", redirect: "follow"});

Example data only. Values, authentication and endpoint behavior must be checked in your own context.

Browser compatibility

Fetch is subject to CORS, browser-managed headers, cookie policies and redirect behavior. A valid generated call may still be unable to reproduce a command-line response in a browser.

Using the generated code

Copy or Download exports code only. Read the compatibility notes before running it; generated headers, URLs or bodies may contain credentials that were present in the source command.

Processing limits

Local tools accept up to 1 MiB, URLs up to 64 KiB, and have a 5-second processing limit. API requests support 100 headers and 100 parameter rows, a 1–120 second timeout and up to 5 MiB of received response data. Long text previews are abbreviated. Requests go directly to your chosen endpoint; CORS and browser policy apply.

?

Frequently asked questions

Does conversion send the request?

No. Parsing and code generation are local. The request runs only if you execute the generated Fetch code elsewhere.

Why can the Fetch call fail while cURL works?

A browser enforces CORS and controls some headers, credentials and redirects. The generated code cannot bypass those policies.

Can it read a file referenced with @filename?

No. Local-file request bodies and multipart uploads are not supported. The converter does not read paths mentioned in a command.

Can I paste PowerShell or Windows cmd quoting?

This converter expects POSIX cURL syntax. Other shell quoting conventions need to be translated before use.

Are authentication values removed from the output?

No. Supported authentication and request data are converted. Review or redact generated code before sharing it.

Find your next tool

Language

Switch language? Your current work will be cleared. Copy or download it first.