cURL to Code
Paste a cURL command, for example from the browser's "Copy as cURL", to get the same request as fetch, axios, PHP (curl extension) or Python (requests) code. The command is never executed or stored.
- Fully offline
Loading…
Features
- Four targets: fetch, axios, PHP and Python
- Headers, body, multipart forms, Basic auth and cookies
- Full support for Chrome and Firefox "Copy as cURL (bash)", including $'...' quoting
- Flags -X, -H, -d, --data-raw, --data-urlencode, -F, -u, -G, -L, -k, -I and more
- Unknown flags and files produce warnings, not errors
- Works offline; the command is never run
Examples
POST JSON to Python
- Input
- curl -X POST https://api.example.com/items -H 'Content-Type: application/json' -d '{"name":"x"}'
- Output
- import requests headers = { "Content-Type": "application/json", } data = "{\"name\":\"x\"}" response = requests.post("https://api.example.com/items", headers=headers, data=data.encode())
FAQ
Is my command executed?
No. Only its text is parsed and converted; no request is sent.
Are Windows cmd commands supported?
No; choose "Copy as cURL (bash)" in DevTools.
Why does -d without -X produce a POST?
That is what curl itself does: data without an explicit method means POST with application/x-www-form-urlencoded.