Convert curl to Python, JavaScript, Go, PHP and more — offline
5 min read
Try cURL Command Parser & Code GeneratorFree, runs in your browser — no upload or sign-up.Open tool →curl
api
http
code generation
API docs and browser DevTools ("Copy as cURL") give you a curl command, but your app needs real code. The cURL Command Parser & Code Generator converts it in your browser — headers, cookies and API keys never leave your device.
How to use it
- Paste the curl command (multi-line commands with \ are fine).
- Pick a language from the list: JavaScript or TypeScript fetch, Axios, Node.js https, Python requests or httpx, Go net/http, PHP cURL or Guzzle, Java HttpClient, C# HttpClient, Rust reqwest or Dart http.
- Copy the code. The breakdown below shows the method, query parameters, headers, cookies, form fields and body.
Flags it understands
-X/--requestfor the method,-Hfor headers and-bor a Cookie header for cookies.-d,--data-raw,--data-binary,--data-urlencodeand--jsonfor request bodies. JSON bodies become native objects (for examplejson=payloadin Python).-Fmultipart fields, including@fileuploads, turned into FormData,files=or multipart builders.-ubasic auth,-Auser agent,-ereferer,-G(data as query string),-I(HEAD) and--compressed.
Example
text
curl -X POST "https://api.example.com/users" -H "Content-Type: application/json" -d '{"name":"Ada"}'becomes this in Python:
text
import requests
headers = {
"Content-Type": "application/json",
}
payload = {
"name": "Ada"
}
response = requests.request("POST", "https://api.example.com/users", headers=headers, json=payload)
response.raise_for_status()
print(response.text)Tips
Remove short-lived session cookies before sharing generated code, and move API keys into environment variables. Shell variables like $TOKEN are copied literally, so replace them with your own values.