cURL to Code Converter
Convert cURL commands to requests in Python, JS, Node, PHP, Go, Ruby, and Java. Fast, free, and fully client-side.
How the cURL to Code Converter Works
Parses a pasted cURL command and rewrites the request as code for Python, JavaScript fetch, Node.js, PHP cURL, Go, Ruby, or Java 11 and later. It reads the URL, the -X or --request method, -H headers, body flags such as -d, and -u basic auth. Quoting is handled simply, so complex shell syntax may need manual edits. Runs in your browser and nothing is uploaded.
Usage Example
Turns a copied browser request with custom headers and a JSON body into Python code for a test script.
Frequently Asked Questions
How is the HTTP method chosen?
The -X or --request value is used when present. Otherwise the method is POST if a body flag such as -d, --data, --data-raw, or --data-binary appears, and GET if neither applies.
Which cURL options are read?
The URL, -H headers, body flags, and -u basic auth credentials are read. Other options, such as -L, -k, or cookie flags, are not translated, so review the generated code before using it.
What if the command uses complicated quoting?
Quote handling is simple, so escaped quotes, line continuations, or shell expansions can produce wrong output. Compare the generated code with the original command before running it.
Browse more
See all developer reference guides and interactive utilities.
