Toolstia / curl to code converter
curl to code converter
Paste a curl command from API docs or your browser developer tools and get working JavaScript or Python code. Headers, data, authentication and the HTTP method are carried over.
Handles the common options: -X, -H, -d, --data-raw, --data-urlencode, --json, -u, -G, -I, -A, -b and -e. File uploads are not supported. Never paste real secrets into any tool you do not trust. Here nothing leaves your browser.
How it works
- Paste the curl command.
- Choose JavaScript fetch or Python requests.
- Copy the code.
Supported options
Method (-X), headers (-H), data (-d, --data-raw, --data-urlencode, --json), basic authentication (-u), -G for query data, -I, user agent, referer and cookies.
Skipped options
Options that only change how curl behaves, such as -s, -L, -k and --compressed, are skipped and listed so you know what was ignored.
Defaults
Data without -X means a POST request, and form data gets the right content type automatically.
Check before use
Review the code and replace real secrets with environment variables before sharing or committing it.
Questions
Does it send the request?
No. It only writes code. Nothing is sent anywhere.
What about file uploads?
The -F and -T options are not supported.
Does it work on Windows curl commands?
Use the Linux or macOS style with single quotes if you can. Double-quoted commands are understood too.