cURL to Code
Parse a cURL command into Fetch, Python and PHP code.
Converted code appears here.
Runs entirely in your browser. Nothing you paste or upload leaves your device.
How to use the curl to code
- Paste a cURL command into the box, or press “Sample”.
- Press “Convert”.
- Pick JavaScript (Fetch), Python (requests) or PHP (cURL), then copy or download the code.
Curl to code example
curl -X POST https://api.example.com/v1/items -H "Content-Type: application/json" -d '{"name":"pen"}' becomes a fetch() call (or Python requests.post) with the same method, headers and JSON body.
Tips for using the curl to code
- Copy a request from your browser's DevTools (Network tab → Copy as cURL) and convert it here.
- Remove cookies and authorisation headers before sharing generated code.
- Check that the content type matches the body format.
Curl to code: common questions
- What does this tool do with my command?
- It reads the URL, method, headers and body from the cURL command and rewrites them as code. Nothing is sent anywhere — the cURL request itself is never run.
- Which cURL options are supported?
- Common ones: URL, method, headers (-H), data (-d) and basic auth. Unusual flags may be left out of the output, so check the generated code before use.
- Is my command uploaded?
- No. Parsing happens in your browser.
- Is the request sent anywhere?
- No. The tool only rewrites the command text; it does not call the URL.