Curl to Fetch Converter

Convert a curl command into JavaScript fetch() code.

Input data is processed in your browser
Data is never sent to a server

Tool

0 chars

or drag & drop a file

What is Curl to Fetch Converter?

Curl to Fetch Converter automatically converts a curl command copied from a terminal into JavaScript code using the fetch() API. It parses headers, method, and request body, generating code ready to run in a browser or Node.js. Useful for turning curl examples from API documentation into frontend code.

How to Use

  1. Paste a curl command into the input field.
  2. With auto-convert enabled, fetch() code is generated instantly as you type.
  3. Switch between async/await style and .then() chain style.
  4. Click "Copy Result" to copy to clipboard.

FAQ

Which curl options are supported?

Major options are supported, including -X/--request, -H/--header, -d/--data, -u/--user, -A/--user-agent, -b/--cookie, and -e/--referer.

How is the JSON body from the -d option converted?

If it can be parsed as JSON, it's converted into a readable form wrapped in JSON.stringify(). If it can't be parsed, it's embedded as a plain string.

Can it handle curl commands that span multiple lines (backslash continuation)?

Yes. Line continuations using a trailing backslash are joined before parsing.

Is my data sent to a server?

No. All processing happens in your browser.