Monu Tools

cURL to fetch Converter

Convert a curl command into equivalent JavaScript fetch code, entirely in your browser.

How to use the cURL to fetch

  1. 01

    Paste a curl command.

  2. 02

    The equivalent fetch code is generated instantly.

  3. 03

    Copy the JavaScript into your project.

Turn curl into fetch

A converter that turns a curl command into equivalent JavaScript fetch code, parsing the method, URL, headers and body so you get a ready-to-use request instead of translating it by hand.

It is a common need: API docs and tools like browser devtools give you a curl command, but your app is written in JavaScript. This bridges the two so you can paste curl and get fetch.

It runs locally in your browser, so your command, including any tokens or credentials in the headers, never leaves your device.

Flags it understands

It understands the common flags: -X for the method, -H for headers, -d and its variants for the body, -u for basic auth, plus -A for the user agent and -b for cookies. A data flag implies POST, matching how curl behaves.

Multi-line commands

Multi-line commands work as-is. Backslash line continuations are joined automatically, so you can paste a command exactly as it appears in documentation without cleaning it up first.

Ready-to-run output

The output is a fetch call with the method, headers and body filled in, which you can drop into your code and await like any other fetch.

Frequently asked questions

Which curl flags are supported?

The common ones: -X for the method, -H for headers, -d and its variants for the body, -u for basic auth, plus -A and -b. A data flag implies POST.

Is my command sent to a server?

No. The conversion runs entirely in your browser, so your command and any tokens in it never leave your device.

Does it handle multi-line commands?

Yes. Backslash line continuations are joined automatically, so you can paste a command exactly as it appears in docs.

Is the generated fetch code ready to run?

Yes. It produces a complete fetch call with the method, headers and body set, which you can use directly with await in your code.

Does a data flag change the method?

Yes, just like curl: including a body with -d implies a POST request unless you set a different method with -X.

Sources

Embed this tool

Add this tool to your own website. Copy the snippet below; it stays up to date automatically.

<iframe src="https://monu.tools/embed/en/curl-to-fetch" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

Related tools