cURL to fetch / axios Converter
Developer
Parses cURL flags (`-X`, `-H`, `-d`, `--json`, `-u`, `-A`, `-b`, …) and emits a clean JS request. Pick `fetch` for the platform built-in or `axios` for the npm library. Multi-line continuations and quoted strings work, so you can paste browsers' "Copy as cURL" output straight in.
—
Target:
JS code
const response = await fetch("https://api.example.com/v1/users", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer abc123",
},
body: "{\"name\":\"Alice\",\"role\":\"admin\"}",
});
const data = await response.json();How to use
- Paste the cURL command in the input box.
- Pick `fetch` or `axios` to match your target.
- Copy the resulting code into your file.
Frequently asked questions
- Where can I get a cURL command to paste?
- Chrome / Firefox / Safari DevTools → Network tab → right-click any request → Copy → Copy as cURL. Postman and Insomnia have a similar export.
- Does it understand `--json`?
- Yes. `--json` shorthand sets the body and adds the `Content-Type: application/json` and `Accept: application/json` headers if you didn't set them already.
- What about `-L`, `-s`, `-v`?
- Flags that don't change the request payload are ignored — `fetch` and `axios` already follow redirects by default, and verbose output is a CLI-only concern.
- Why does axios output put the body as `data:`?
- axios uses `data` for request bodies, and if the body parses as valid JSON the converter emits it as a JS object literal. If it doesn't parse, it falls back to a string.
Related tools
JWT Decoder
Decode a JSON Web Token to inspect its header, claims, and expiration.
Developer00
UUID Generator
Generate random version-4 UUIDs in bulk, with copy.
Developer00
Hash Generator (SHA)
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.
Developer00
URL Encoder / Decoder
Percent-encode text for URLs, or decode encoded URLs back to text.
Developer00
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.
Developer00
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.
Developer00