curl to Code Converter

Convert a curl command into ready-to-run fetch, Node.js, Python, Go, or PHP code — 100% in your browser, no upload

🔒 Parsed and converted entirely in your browser — your command, tokens and body are never uploaded.

A curl command, rewritten in five languages

CurlToCode parses a curl command and rewrites it as equivalent source code in the language you pick — a JavaScript fetch() call, a Node.js request using the built-in http/https module, a Python requests script, a Go net/http program, or a PHP cURL snippet. It understands the flags you see most often in copied commands: -X/--request for the method, -H/--header for headers, -d/--data/--data-raw for the request body, and -u user:pass, which it turns into a Basic Authorization header. Quoted arguments, bash $'...' quoting, backslash line-continuations and multi-line pastes are all handled, so you can paste a command exactly as the browser "Copy as cURL" feature produced it — on Windows, choose the bash (POSIX) version rather than the cmd one, whose ^ escapes are not read.

How to use it

Paste your curl command into the box, choose a target language, and the generated code appears instantly below — ready to copy or download. When no request body is present the method defaults to GET, a lone -d makes it POST, -I makes it HEAD, and -G moves the -d data into the query string, matching how curl behaves. Everything runs locally in your browser, so it is safe to convert commands that carry API tokens or credentials. This tool is the exact inverse of our curl command builder: build a command there, or paste one here to get working code.

Frequently asked questions

Which curl flags are supported?

The common ones in copied commands: -X/--request for the HTTP method, -H/--header for headers, -d/--data/--data-raw (and --data-binary) for the body, --url, -u user:pass which becomes a Basic Authorization header, -I/--head for HEAD, -G/--get to send -d data in the query string, and -b/--cookie name=value text as a Cookie header. --compressed is accepted and ignored because fetch, requests and the others negotiate compression for you. Boolean flags such as -s, -L and -k are safely skipped.

What does the Node.js output use?

It uses the built-in Node http or https module, chosen from the URL scheme, so the generated snippet has zero npm dependencies. Prefer fetch? Node 18+ ships a global fetch(), so the JavaScript (fetch) target also runs in modern Node.

Is my curl command or its tokens uploaded anywhere?

No. Parsing and code generation happen entirely in your browser with JavaScript. Your URL, headers, bearer tokens and request body never leave your device — nothing is sent, logged or stored.