Code · Made a little simpler

cURL to Fetch Converter

Convert a POSIX cURL command to a Fetch snippet. Inspect its URL, method, headers, body and redirect behavior before copying or downloading the code.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Use one HTTP(S) request with literal URLs, headers and body text. Handles common method, header, data, JSON, HEAD and redirect options.

The tool generates text. It keeps the request on this device.

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

cURL to Fetch Converter: how to use it

  1. Paste a single cURL command or load the example JSON POST.
  2. Convert to Fetch and verify the request mapping. Resolve any unsupported options, repeated headers or browser-controlled fields.
  3. Copy the JavaScript or download fetch-request.mjs. Check your browser’s CORS policy and redirect handling in your application.

Limits and notes

Accepts one POSIX cURL command up to 32,768 characters, with HTTP(S), common method, header, HEAD, data, JSON and redirect options. Supports up to 40 headers and a 16 KiB UTF-8 body. File references, shell expansions, repeated data options and unsupported Fetch mappings are declined.

How your privacy works →

cURL to Fetch Converter: common questions

Does it preserve large integers or repeated JSON keys?

The body remains literal text in the generated JavaScript. Values are not parsed into JavaScript numbers or objects.

Why was my Cookie or Host header declined?

Browser Fetch controls which headers script can set. This converter reports those fields instead of silently dropping them.

Does the output follow redirects?

It follows redirects when the cURL command includes --location. Otherwise the snippet uses manual mode, which can give an opaque redirect response in a browser.

Guides