cURL → code

Translate a cURL command into fetch, axios or Python requests code.

Private by design. Your input never leaves this browser. Conversions run locally on your device.

What this tool handles

  • Translates one cURL invocation into JavaScript fetch, axios or Python requests.
  • Understands quoting, backslash escapes and backslash line continuations.
  • Shell expansion is not evaluated — $VAR, ${VAR}, $(...) and backticks pass through as literal text.
  • Pipes, redirections, subshells, && chains and multiple URLs are not translated.
  • Transport-only flags such as -s, -v, -k and --compressed are listed rather than converted.

Example

cURL command

curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{"name":"Ada"}'

Generated code

// Generated by DevConvert from a cURL command — review before running.

const url = "https://api.example.com/users";

const payload = {
  "name": "Ada",
};

const response = await fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});

if (!response.ok) {
  throw new Error("Request failed with status " + response.status);
}

const data = await response.json();
console.log(data);

// TODO — cURL features this conversion does not cover:
//   - multipart uploads (-F / --form): build FormData (JS) or files= (requests)
//   - @file data references (-d @body.json): read the file explicitly
//   - shell expansion and subshells ($VAR, ${VAR}, $(...), backticks)
//   - option files (--config / -K) and ~/.curlrc defaults

Related tools

  • JWT Decoder — Decode a JSON Web Token header and payload locally. Signatures are not verified.
  • Base64 Encode / Decode — Encode and decode Base64 and Base64URL with correct UTF-8 handling.
  • URL Encode / Decode — Percent-encode or decode text, or break a full URL into its parts.
  • Hash Generator — Compute SHA-256, SHA-384, SHA-512, SHA-1 and MD5 digests of text or a file.
  • JSON → Python — Generate Python dataclasses from a JSON sample.

Browse all 25 tools