cURL to Code Converter

Paste any cURL command and get clean, runnable code for Python, JavaScript, Node.js, cURL, PowerShell, Go, PHP, Ruby, Java or raw HTTP — converted live, 100% in your browser.

Copy the curl line out of an API browser, a Postman export or a terminal history and paste it below. The converter understands multi-line commands with backslash or Windows ^ continuations, single- and double-quoted values, and the full range of common options: headers, request bodies (JSON, form data, multipart file uploads), authentication (basic, bearer, cookies), redirects, TLS settings, timeouts, proxies and more. Pick a target language from the tabs and copy or download the result.

🔒 100% private — nothing is uploaded or stored. Your cURL command is parsed and converted entirely in this browser tab and never leaves it — there is no server-side processing and no network request. Commands often contain API keys, tokens and credentials; converting them here means those secrets never touch a server. It also keeps working offline.
Try a sample:

cURL command

Paste your curl command — single line or wrapped across many lines. The conversion updates as you type.

Converted code


How the converter parses your command

cURL commands are shell commands, so the first job is a small shell-style tokenizer rather than a naive split on spaces. It handles:

  • Line continuations. A trailing backslash (Unix) or caret (cmd.exe) at the end of a line joins the next line, so commands copied from terminals or PowerShell wrap cleanly.
  • Quoting. Single quotes are fully literal; double quotes process backslash escapes (\", \\, \$). Unquoted text is split on whitespace, and a backslash escapes the next character.
  • Options. Long options (--data-raw), short options (-d), combined shorts (-sL), attached values (-d'{"a":1}', -XPOST) and the --option=value form are all recognised.
  • Shell leftovers. If the paste contains a pipe, redirect or command chain (curl ... | jq), only the curl part is converted and you are told what was dropped. Shell variables such as $TOKEN cannot be expanded in the browser, so they are kept verbatim with a warning — paste the expanded value for a faithful result.

What gets preserved

cURL optionWhere it goes in the generated code
-H / --headerRequest headers, in original order. Header: with an empty value suppresses that default header, exactly like curl.
-d, --data-raw, --data-binaryRequest body. Multiple -d flags are joined with &, as curl does.
--data-urlencodeBody (or query string with -G), with the value percent-encoded.
-F / --formMultipart body using each language's multipart API, including @file uploads with ;type= and ;filename= modifiers.
-u / --userBasic auth: auth=(user, pass) in requests, SetBasicAuth in Go, or a pre-computed Authorization: Basic header elsewhere.
--oauth2-bearerAuthorization: Bearer header.
-b / --cookieCookie header (a cookies dict in requests).
-A, -eUser-Agent and Referer headers.
-X, -I, -T, -GMethod. -G moves body data into the query string and forces GET, as in curl.
-L, --max-redirsRedirect following (and a note where the target has no max-redirects setting).
-k, --cacert, --cert / --keyTLS verification settings: verify=False, custom CA bundles, client certificates where the target supports them.
--max-time, --connect-timeoutTimeouts.
-x / --proxyProxy configuration where the target supports it.
--compressedAccept-Encoding header (Go already does this automatically, so it is left to the standard library there).
URL query stringKept in the URL for most targets; a params mapping in Python requests.

Behaviour differences to know

  • Redirects. curl does not follow redirects unless you pass -L. Most HTTP libraries do the opposite: requests, fetch, Go, PHP and Java follow by default. The generated code is written to match your command — no -L means the code will not follow either.
  • -k in the browser. Browsers cannot skip TLS certificate verification for security reasons, so the JavaScript (fetch) output carries a comment instead of a flag. The Node.js, Python, Go, PHP, Ruby and Java outputs can all disable verification.
  • Cookies in the browser. Browsers forbid scripts from setting the Cookie header on cross-origin requests; the fetch output includes a note. Same-origin or Node.js usage is unaffected.
  • JSON bodies. When the body is valid JSON and you did not set your own Content-Type, Python requests uses json= and fetch uses JSON.stringify() — both set Content-Type: application/json themselves. If you did set a Content-Type, the raw body is sent as-is to keep your header authoritative.
  • -X is a hint, not a rule. curl sends whatever body you give it even if the method looks wrong (-X GET -d 'a=b' sends a body on a GET). The converter preserves that faithfully — including the oddness.
  • File uploads and file bodies. The converter cannot read your files, so -F name=@file and --data-binary @file become code that reads the file at runtime from the same path. Move the file next to the script (or adjust the path) before running.
  • Display-only options. -s, -v, -#, -w and the --trace* family only affect curl's own output, so they are dropped silently. Options that cannot be represented (FTP/SSH options, --raw, --netrc, custom cipher suites, ...) are dropped with a visible warning.

Supported options at a glance

StatusOptions
Preserved -X -I -T -G -d --data-raw --data-binary --data-urlencode -F --form-string --json --url-query -H -A -e -b -u --oauth2-bearer --password -L --max-redirs -k --cacert --cert --key -x --proxy-header --max-time --connect-timeout --retry --compressed -o --url
Noted (kept as a comment in the output) --http1.1 --http2 --http3 --ipv4 --ipv6 --limit-rate --fail --include --globoff --path-as-is --resolve --interface --location-trusted --post301/302/303 --basic --retry-delay --retry-max-time
Dropped with a warning FTP/SSH/Telnet options, --raw, --netrc, --config, --unix-socket, --socks4/5, custom cipher suites and TLS version pins, --digest/--ntlm auth, --cookie-jar, --doh-url, --parallel
Dropped silently (display-only) -s -S -v -# -w --trace --trace-ascii --trace-time --log-error --progress-bar

⚠️ Things to know

  • The output is a starting point. Secrets pasted into the command end up in the generated code verbatim. For anything you commit, move tokens into environment variables or a secrets manager first.
  • Unrecognised options are never guessed at. If an option is not in the table above, you get a warning naming it — the generated code is never silently wrong about what it does.
  • Multiple URLs and --next describe several transfers; the first transfer is converted and the rest are reported.

Luke Keam
Thank you for reading. Get in touch
Luke Keam | techgeek.biz