Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Turn any cURL command into Fetch, Axios, jQuery, XHR, or Node.js code, with headers, body, and auth mapped for you.
cURL to JavaScript is a free online converter that turns a cURL command into equivalent JavaScript HTTP request code. It reads the request method, URL, every -H header, the -d body, and -u basic auth, then rebuilds the same request in your chosen JavaScript client so you can run it from the browser or Node.js.
The tool emits six formats: the browser Fetch API, Axios, jQuery AJAX, XMLHttpRequest (XHR), the Node.js request library, and the built-in Node.js http and https modules. Parsing happens with the same tokenizer logic a shell uses, so flags and quoted values are read correctly. For a single library output, the cURL to Axios converter is the focused alternative.
Converting a cURL command to JavaScript takes only a few seconds, and you do not need to install anything to use the converter itself. Follow these steps:
All processing happens in your browser. No data is uploaded, so the URLs, headers, and credentials in your cURL command never leave your device.
cURL and JavaScript fetch both send HTTP requests, but they live in different places. cURL is a command-line program you run in a terminal, while fetch is an API you call from JavaScript inside a browser or Node.js. The table below sums up how the two differ:
| Aspect | cURL | JavaScript fetch |
|---|---|---|
| What it is | A command-line tool for transferring data over HTTP | A built-in JavaScript API for making HTTP requests |
| Where it runs | In a terminal or shell script | In the browser or in Node.js code |
| Setting headers | One -H flag per header on the command line | A headers object passed in the options argument |
| Request body | Passed with -d or --data as a raw string | Set as the body option, often via JSON.stringify |
| Response handling | Prints the response to standard output | Returns a promise you resolve, then call response.json() |
| Typical use | Quick API testing, scripts, and documentation examples | Application code that calls APIs from web or server |
As a tool, the cURL to JavaScript converter offers a few capabilities that make turning a request into code effortless. Here are the features of our converter:
Converting cURL to JavaScript is useful anywhere an HTTP request needs to move from the terminal into application code. The converter speeds up each of these workflows:
This converter is maintained by TestMu AI (formerly LambdaTest), the team behind a unified testing platform, so it is shaped by the same focus on reliable, well-tested APIs that QA and development teams depend on every day.
A cURL to JavaScript converter translates a cURL command into JavaScript HTTP request code, mapping the method, URL, headers, request body, and basic auth into the syntax of Fetch, Axios, jQuery, XHR, or Node.js.
The tool generates six output formats: the browser Fetch API, Axios, jQuery AJAX, XMLHttpRequest (XHR), the Node.js request library, and the built-in Node.js http and https modules.
Yes. All parsing and conversion happen in your browser with client-side JavaScript, so your cURL command, URLs, headers, and tokens never leave your device or get uploaded to a server.
Yes. Every -H header is mapped to the target format, JSON and raw bodies from -d are converted to the correct body field, and basic auth from -u is mapped to an Authorization header or auth option.
Fetch is the built-in browser API and needs no install, while Axios is a library that must be imported and returns parsed JSON automatically. The converter emits idiomatic code for each so you can pick the one your project uses.
Yes. The Axios output runs in both the browser and Node.js, and the Node.js (request) and Node.js (http/https) outputs are built specifically for server-side use with require statements.
Yes. The converter reads the -X or --request flag, and when a -d body is present without an explicit method it defaults to POST, matching how cURL itself behaves.
Yes, the converter is completely free with no signup, subscription, or credit card required, and you can copy or download the generated JavaScript as a .js file.
Did you find this page helpful?
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance