cURL to JavaScript Converter
Runs entirely in your browser
Paste a curl command and get equivalent JavaScript fetch() code, generated directly in your browser.
What is cURL to JavaScript?
cURL to JavaScript parses a curl command's method, URL, headers and body, and generates equivalent JavaScript using the native fetch() API — useful when porting a curl example from API documentation into browser or Node.js code.
How to use cURL to JavaScript
- Paste a curl command into the Input box.
- Click Convert.
- Copy the generated fetch() code.
Features
- Supports method, headers, body and HTTP Basic auth.
- Generates modern async/await fetch() code.
- Never runs the request itself.
- 100% client-side — your command never leaves your browser.
Frequently Asked Questions
Which curl flags are supported?
-X/--request, -H/--header, -d/--data (and --data-raw/--data-binary/--data-urlencode), -u/--user, -A/--user-agent, -b/--cookie, --url, and a bare URL. Other flags are ignored rather than causing an error.
Is my command uploaded to a server?
No. Parsing and code generation both happen entirely in your browser.
How is basic authentication (-u) converted?
It's converted into an Authorization: Basic header with the credentials base64-encoded, exactly as curl sends it on the wire.
Does this run the request?
No. It only generates the fetch() code — you run it yourself.