cURL to code
Paste a curl command, check the request it sends, then copy it as code in seven languages.
Parsing and code generation happen in this browser tab. Nothing is uploaded, saved or sent — not even to us.
Paste a curl command above to see the request summary and code.
How to use it
- Paste a curl command — from DevTools (Copy as cURL), API docs or a chat. The code appears as you type.
- Read the summary line first: method, URL, header count and body size. If the summary is right, the code below is right.
- Pick the target language; the code and the download filename change without touching your command.
- Warnings point at anything the code does not represent — proxies, redirects, shell variables. Errors stop generation instead of showing half a request.
- Reset clears the input and returns to Python; reloading the page does the same.
Example
Command
curl -X POST 'https://httpbin.org/anything?from=en' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer demo-token' \
-d '{"name": "Ada", "city": "London"}'Python
import requests
url = "https://httpbin.org/anything?from=en"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer demo-token",
}
data = "{\"name\": \"Ada\", \"city\": \"London\"}".encode("utf-8")
response = requests.request("POST", url, headers=headers, data=data)
print(response.status_code)
print(response.text)The summary and the code above are generated from that command — this tool never calls httpbin. The supported subset is method, URL, headers, body, Basic/Bearer auth and timeout.
Rules, limits and known issues
- No file uploads: -F, -T and @file inputs are rejected, so you never get code that silently drops a file.
- No shell execution: variables, command substitution, pipes and multiple commands are not expanded; $TOKEN stays literal with a warning.
- One URL per command: extra URLs are ignored with a warning, not turned into a loop.
- Transport options are not reproduced: -L, -k, proxies, client certificates, HTTP versions, retries and compression only produce a warning. Generated code uses its client defaults.
- No implicit curl defaults: User-Agent: curl/… and Accept: */* are not added; pin them with -A / -H.
- POSIX quoting only: single quotes, double quotes, $'...' and backslash line continuations; Windows CMD escaping is not parsed.
- Duplicate headers survive in Go, PHP, Java, C# and Ruby; Python and JavaScript dictionaries merge them with ", ".
- A GET/HEAD request with a body is generated as written, with a warning — fetch refuses it.
- No history or persistence: reloading clears everything; the share button shares the page link, never your command.
- This tool only converts; it never sends the request. Use the API client if you also want to see the response.
Related tools
Handy after converting a command.