Curl To Code

Convert a raw curl command into fetch, Python, Axios or Go — instantly.

100% client-side

curl command

Paste a curl command to convert it.

Generated code


      

How curl-to-code conversion works

A curl command is really just a compact description of an HTTP request: a method, a URL, some headers and maybe a body. This tool tokenizes the command the way a real shell would — respecting single quotes, double quotes and backslash escapes — so a header value or JSON body containing spaces doesn't get cut in the wrong place, then maps each flag to the equivalent option in your target language:

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

// fetch
fetch("https://api.example.com/users", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ name: "Ada Lovelace" })
});

Everything — tokenizing, parsing and code generation — runs with plain JavaScript in your browser. No external libraries, no server calls.

Frequently asked questions

Is my curl command sent to a server?

No. The command is parsed and converted entirely in your browser with plain JavaScript; nothing is uploaded anywhere.

Which curl flags are supported?

-X/--request, -H/--header, -d/--data/--data-raw/--data-binary, -F/--form, -u/--user and --url. Common flags that don't affect the generated request, like -s, -v, -k or -L, are recognized and safely ignored.

Why does -d turn the request into a POST?

That's curl's own real behavior: passing -d/--data without an explicit -X defaults the method to POST. This tool mirrors that exactly, so the generated code matches what curl actually sends.

Does it handle quoted headers and JSON bodies with spaces?

Yes. The command is tokenized respecting single quotes, double quotes and backslash escapes, the same way a shell would — a naive split on spaces would cut a header value or JSON body in the wrong place.