Developer Toolbox
← Back

cURL ↔ fetch ↔ Axios

Convert between cURL, fetch, and Axios. Supports reverse conversion (fetch → cURL, Axios → cURL) with best-effort parsing.

Conversion mode
Input (cURL)
Reverse conversion is best-effort: it works well for typical snippets/config objects. Very dynamic code may not parse.
Output (fetch)
// fetch
const res = await fetch("https://httpbin.org/post", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  body: "{\"hello\":\"world\"}",

});

const contentType = res.headers.get("content-type") || "";
const data = contentType.includes("application/json")
  ? await res.json()
  : await res.text();

console.log(res.status, data);