cURL ↔ Code Converter

Paste a cURL command to get equivalent JavaScript, Python, Node.js, PHP, and Go — or paste code to get the cURL command back. Runs entirely in your browser.

Copied

Last updated

cURL command

Convert a cURL command above to see JavaScript fetch code here.
Copied
Convert a cURL command above to see Node.js code here.
Copied
Convert a cURL command above to see Python requests code here.
Copied
Convert a cURL command above to see PHP code here.
Copied
Convert a cURL command above to see Go code here.
Copied

Reverse: code → cURL

The equivalent cURL command will appear here.
Copied
Limitation: this direction is a best-effort pattern match, not a JavaScript or Python interpreter. It recognizes a single literal fetch(url, options) call or a single literal requests.get/post/put/patch/delete(url, ...) call, with the URL, method, headers, and body/json/data written as plain string, number, or object literals directly in the call. It cannot resolve variables, template-literal interpolation, imported helper functions, chained builders (e.g. axios instances), or multi-statement setup code — paste just the call itself for best results.

About this tool

The forward direction parses your cURL command the way a shell would: it respects single and double quotes, backslash line continuations, and escaped characters, then reads the flags cURL itself understands — -X/--request, -H/--header, -d/--data (and its --data-raw/--data-binary/--data-urlencode variants), -F/--form for multipart uploads, -u/--user for basic auth, -b/--cookie, -A/--user-agent, and -e/--referer. From that it builds one normalized request model — method, URL, headers, and body — and renders it into each language's idiomatic client: fetch for the browser, Node's built-in fetch (Node 18+) wrapped in an async function, Python's requests library, PHP's curl_* functions, and Go's net/http. A body is treated as JSON when a Content-Type: application/json header is present or the payload parses as JSON on its own; otherwise it's sent as form-urlencoded or raw, matching what cURL itself would actually put on the wire.

Basic auth (-u user:pass) is converted into an explicit Authorization: Basic … header using the browser's own base64 encoder, so the generated code doesn't depend on each language's auth helper behaving identically. Multipart form fields (-F) become a FormData/multipart/form-data body in each target language, including a marked distinction between plain fields and file uploads (-F "file=@path").

Nothing you paste is sent anywhere — parsing, code generation, and syntax highlighting all run as JavaScript in your browser tab.