cURL to Code Converter
Convert a curl command into JavaScript fetch, axios or Python requests code.
Convert a cURL request into application code without sending it
Parse supported methods, headers, request bodies and basic authentication into fetch, axios or Python requests code locally.
JavaScript (fetch)
mode
172 B
input size
267 B
output size
cURL command
172 charactersGenerated code
267 charactersGenerated code is a starting point. Review authentication, redirects, TLS, timeouts and error handling before production use. Nothing is executed here.
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
curl -X POST ... -d '{...}'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.
Continue your workflow
Open a related tool to prepare your files or refine the finished result.
- Featured toolDeveloper ToolsHTTP Header Parser
Parse raw HTTP request or response headers into a readable table.
Open tool - Featured toolDeveloper ToolsJSON Formatter
Format, validate and minify JSON instantly.
Open tool - Featured toolDeveloper ToolsURL Encoder / Decoder
Percent-encode or decode URLs and query strings.
Open tool
