cURL to fetch / axios Converter
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.
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
String Escape Converter
Escape a string for 10 contexts at once — JavaScript, JSON, HTML entities, URL, SQL, regex, Bash (single/double quote), C string, Unicode \u escapes. Copy whichever you need.
Unicode Escape Converter
Encode text to \uXXXX, U+XXXX or HTML entities — and decode any of those back to text. Handles emoji and astral characters.
Regex Tester
Test JavaScript regular expressions live with highlighted matches and replace preview.
Base64 to Hex Converter (and back)
Convert a Base64 string to hexadecimal bytes and hex back to Base64, with URL-safe support, in your browser.
HTML → JSX Converter
Paste an HTML snippet and get React-ready JSX — `class` becomes `className`, `onclick` becomes `onClick`, void tags self-close, inline styles can be object-ified.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.