Paste a curl command, copy working code in Python (requests), JavaScript (fetch), and Node (axios) — conversion runs entirely in your browser, so tokens and API keys never leave your machine. JSON bodies become native dictionaries and objects, -d forms become data=/URLSearchParams, -u becomes basic auth, and -G, --compressed, -k, and -m map to each client's idiomatic option. Commands with real shell syntax ($(), pipes, FOO=bar prefixes) are parsed with the actual bash grammar — tree-sitter WebAssembly, lazily fetched from the CDN only when needed — with an offline tokenizer as the fallback.
Quick answer: paste your full curl command below. The converter maps -H to headers, JSON -d to a real body, -u to auth, -F to multipart, and -m to a timeout in all three targets. Parsing runs entirely in your browser — tree-sitter-bash (MIT, WebAssembly) loads on first paste, with a built-in tokenizer as fallback. Nothing is sent to a server.

Your curl Command


Advertisement

curl Flag → Target Code Reference

curl flagWhat it doesPython requestsJS fetchNode axios
-X, --requestHTTP methodrequests.post(...)method:axios.post(...)
-H, --headerRequest headerheaders={}headers: {}headers: {}
-d, --data (JSON)Request bodyjson={}JSON.stringify()object arg
-d (k=v pairs)Form bodydata={}URLSearchParamsURLSearchParams
-F, --formMultipart uploadfiles={}FormDataFormData
-G, --getMove -d to queryparams={}query in URLparams: {}
-u, --userBasic authauth=(u, p)btoa() headerauth: {}
-b, --cookieCookiesCookie header in all three
-A, --user-agentUser agentUser-Agent header in all three
-m, --max-timeTimeout (s)timeout=AbortSignal.timeout()timeout: (ms)
-k, --insecureSkip cert checkverify=Falsecomment (browsers won't)comment
-L, --locationFollow redirectsdefault behavior in all three
--compressedRequest compressionautomatic in all three
-I, --headHEAD requestHEAD method in all three

How the curl Converter Works

The tool treats your paste as what it is — a shell command — instead of guessing with regexes. On first input it lazily loads tree-sitter's bash grammar compiled to WebAssembly (both MIT licensed, served from a CDN) and parses the command into an exact token list: quoting styles, escapes, and backslash line continuations included. A built-in tokenizer produces the same tokens if the CDN is unreachable, so the tool always works offline-ish. The token list becomes a request model (method, URL, headers, body type, auth, options), and three code generators turn that model into runnable Python, browser JavaScript, and Node.js.

What the parser handles

A worked example

Take a typical authenticated POST:

curl -X POST https://api.example.com/v1/users \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer tok_123' \
  -d '{"name":"Ada","role":"admin"}'

The parser reads four arguments after curl: the method, two headers, and a JSON body it can parse structurally. Python output:

import requests

url = "https://api.example.com/v1/users"
headers = {
    "Authorization": "Bearer tok_123",
}
json_data = {
    "name": "Ada",
    "role": "admin",
}

response = requests.post(url, headers=headers, json=json_data)
print(response.status_code)
print(response.text)

Note the Content-Type header disappeared: requests sets it automatically when you pass json=, and re-sending it would be redundant. The fetch version uses body: JSON.stringify(...) for the same reason, and the axios version passes the object as the second argument. Paste the command above into the tool to see all three side by side.

Why browser-side matters

API tokens routinely ride inside curl commands copied from internal docs. This page never sends your paste anywhere — the parser is WebAssembly running locally, the same architecture the popular MIT-licensed curlconverter project uses. If you're pasting a command with a production bearer token, that's the difference worth knowing about.

Frequently Asked Questions

How do I convert a curl command to Python requests?

Paste the full curl command into the converter above and switch to the Python tab. The tool maps -H headers to a headers dict, JSON -d bodies to a json= argument, form bodies to data=, -u to auth=, and -m to timeout=, then emits a complete requests script you can run as-is.

How do I convert curl to JavaScript fetch?

Paste the command and pick the JavaScript fetch tab. The method, headers, and body are rewritten as a fetch() call: JSON data becomes JSON.stringify(...), form data becomes URLSearchParams, and -m --max-time becomes AbortSignal.timeout(). The Node axios tab covers axios-style projects.

Does the curl converter send my commands anywhere?

No. Parsing and code generation happen entirely in your browser. The parser itself (tree-sitter-bash compiled to WebAssembly, MIT licensed) loads from a CDN the first time you paste; if that fails, a built-in tokenizer takes over. Nothing you paste is transmitted.

Why does curl -d make the request a POST?

That's curl's own behavior: any -d/--data, --data-raw, --data-binary, or -F/--form flag implies POST unless you override with -X. The converter follows the same rule, and -G flips it back to GET by moving the data into the query string.

What curl flags does the converter support?

The common set: -X method, -H/--header, -d/--data/--data-raw/--data-binary/--data-urlencode, -F/--form, -u/--user, -b/--cookie, -A/--user-agent, -e/--referer, -G/--get, -I/--head, -L/--location, -k/--insecure, --compressed, -m/--max-time, --url, quoting styles ('...', "...", $'...'), and backslash line continuations. Unsupported flags are listed in a comment so nothing disappears silently.

Why does my converted code use a variable like $TOKEN literally?

A shell command with $TOKEN can't be converted to a literal value without running the shell — the converter doesn't know what the variable holds. It keeps the reference ($TOKEN) in the generated code and warns you, so you can substitute a real value or read it from an environment variable in the target language.

Advertisement