cURL to Code
Convert a curl command to JavaScript fetch, Python requests, axios, PHP or Go.
About this tool
Paste a curl command from API documentation or your browser's ‘Copy as cURL’, choose the output language, and copy the code. The status line shows the method, URL, header count and body size the parser found. Multi-line commands with backslashes and both quote styles are handled.
What gets translated
API docs show requests as curl because it is universal; turning one into application code by hand means remembering how every flag maps to a library. The converter handles the common ones: -X for the method, -H headers, -d, --data-raw and --data-binary bodies, --data-urlencode, --json (which also sets the JSON headers), -F multipart fields and file uploads, -u basic auth, -A user agent, -b cookies, -e referer, -G to move data into the query string, -L and -k. JSON bodies become native objects — JSON.stringify in JavaScript, json= in Python — rather than escaped strings. The method defaults to POST when there is a body, as curl does. The command is parsed, never executed, and nothing leaves your browser. One caution: a ‘Copy as cURL’ from browser developer tools includes your session cookies and authorisation tokens; remove them before sharing the output or committing it. Uncommon flags such as --proxy, client certificates and --resolve are ignored. The URL parser splits addresses, the JSON formatter tidies bodies, the URL encoder escapes parameters (URL encoding explained: why spaces become %20 (or +), and what has to be escaped), and the HTTP status code reference explains the response (HTTP status codes explained — the ones you'll actually meet, and what to do about them).
Frequently asked questions
How do I copy a request as cURL?
In Chrome, Edge or Firefox developer tools, open the Network tab, right-click the request and choose Copy → Copy as cURL. Paste it here.
Does it run the request?
No. The command is only parsed and converted; no network request is made.
Are form uploads supported?
Yes. -F fields become FormData in JavaScript, data/files in Python requests, form-data in axios and CURLFile in PHP. Go gets a comment pointing to multipart.NewWriter.
Is my token uploaded?
No — everything runs in your browser. Still, remove real tokens and cookies before sharing generated code.