Skip to content

cURL to code converter

Turn a curl command into runnable Python, JavaScript or Node.js code.

Input
Output

cURL to code converter

Paste a curl command and get back the same request as clean, runnable code. Pick Python with the requests library, browser fetch, or Node.js with its built-in fetch, and the converter rewrites the URL, method, headers, request body and basic auth into idiomatic code for that language. It is the fastest way to move a request out of your terminal or out of an API doc and into an actual script.

The parser handles the things people really copy: commands split across several lines with trailing backslashes, single- and double-quoted arguments, multiple -H headers, and -d, --data or --data-raw bodies. When the body is JSON it is passed the right way for each target — json= in Python, JSON.stringify in fetch — instead of a raw string you have to fix by hand. The method is taken from -X, or inferred as POST when there is data and GET otherwise. A -u user:password becomes a proper auth tuple or an encoded Authorization header. Noise like --compressed, -s and -L is quietly dropped, since it does not change the request.

This is a text transformation, not an HTTP client. The tool reads the command as text and writes code — it never opens the URL, never sends the request, and nothing you paste leaves your browser. That matters, because a curl command copied from dev tools often carries a session cookie, an API key or a bearer token in its headers, and those stay on your machine.

Choose the language, copy the result, or download it as a file. Change the target and the same command is rewritten instantly, so you can compare how the request looks in each language.

FAQ

Which languages can it generate?
Python using the requests library, JavaScript using the browser fetch API, and Node.js using its built-in global fetch. Switch between them with the Language option and the same command is rewritten instantly.
Does it send the request or contact the URL?
No. This is a pure text-to-code transformation. The command is parsed as text and turned into a snippet; the URL is never opened and no request is ever made.
Is my curl command uploaded anywhere?
No. Everything runs in your browser, so API keys, bearer tokens and session cookies in your headers never leave your device. Nothing is stored or sent to a server.
How is the HTTP method decided?
An explicit -X or --request wins. Otherwise the tool uses POST when the command has a body (-d, --data and friends) and GET when it does not, matching curl's own behaviour.
What if the text is not a curl command?
If there is no curl token or no URL to request, the tool shows a calm message asking you to paste a command that starts with curl and includes a URL, rather than guessing.