Developer Tools
cURL to Code Converter
Convert a curl command into JavaScript fetch, axios or Python requests code.
Free foreverRuns in your browserNo sign-up
Supports method, headers, data and basic auth. Everything is converted locally in your browser.
About the cURL to Code Converter
Documentation and browser dev tools often give API examples as curl commands, but you may need them in JavaScript or Python.
This tool parses a curl command, including the method, headers, request body and basic auth, and generates equivalent fetch, axios or Python requests code.
Everything is converted locally in your browser.
Key features
- Outputs fetch, axios or Python requests
- Handles method, headers, data and basic auth
- Formats JSON bodies where possible
- Local, private conversion
How to use
- 1Paste a curl command.
- 2Choose fetch, axios or Python.
- 3Copy the generated code.
Examples
POST to fetch
Input:
curl -X POST ... -d '{...}'Output:
await fetch(url, { method: 'POST', ... })The method, headers and JSON body are mapped into a ready-to-run fetch call.
Frequently asked questions
- Which curl options are supported?
- The common ones: -X/--request for the method, -H/--header for headers, -d/--data and its variants for the body, and -u/--user for basic auth.
- Does it run the request?
- No. It only converts the command to code. It never sends the request, so any tokens in the command stay on your device.
- Can it output other languages?
- Currently JavaScript (fetch and axios) and Python (requests). These cover the most common needs.
