cURL to Fetch Converter

Runs in your browser — your data is never uploaded.

Paste a curl command and get working JavaScript fetch code. It is built for the real input — the multi-line, backslash-continued, twelve-header block you get from “Copy as cURL” in a browser’s network panel — so headers, request method and body all come through, and flags with no fetch equivalent are skipped rather than choking the parser. A JSON body is emitted as a real object inside JSON.stringify, not a long escaped string, so you can edit it. Runs entirely in your browser.

0 characters · runs entirely in your browser

How to use cURL to Fetch

  1. 1

    Copy a request as cURL from your browser’s network panel, or write one by hand.

  2. 2

    Paste it in and choose async/await or promise style.

  3. 3

    Click “Convert” and copy the fetch code.

Share

Embed this tool on your site

Paste this where you want the tool to appear. It runs entirely in your visitor's browser — no uploads, no account, no tracking.

Please keep the attribution line — it's what keeps these tools free.

Need a different size, a dark theme, or a different tool? Build an embed lets you preview it first.

Frequently asked questions

Does it handle “Copy as cURL” from Chrome or Firefox?+

Yes — that is the case it is designed around. Backslash line continuations, single-quoted headers, --data-raw bodies and flags like --compressed and -L are all handled; the ones fetch has no equivalent for are ignored rather than treated as errors.

Why is my JSON body wrapped in JSON.stringify?+

Because a body you can read and edit is more useful than a single escaped string literal. If the body parses as JSON it is re-emitted as an object literal; if it does not — form-encoded data, for instance — it stays a plain string.

What happens to -u basic auth?+

It becomes an Authorization header built with btoa, so the credentials stay visible and editable in the generated code rather than being pre-encoded into an opaque blob.

Are cookies and sessions included?+

A -b/--cookie flag is not translated, and a Cookie header copied from your browser will be. Be careful pasting a command copied from a logged-in session anywhere — it usually contains a live session token.

Does it run the command?+

No. It only reads the text and prints code — nothing is executed, no variables are expanded, and no request is made. Nothing is uploaded either.