cURL to Code
Paste any cURL command — get equivalent fetch, axios, Python requests, or Node.js code instantly, in your browser.
cURL command
About this tool
A browser-based cURL command converter that turns curl into runnable code in four languages. Paste a command (including multi-line backslash continuations), see it parsed into URL, method, headers, and body, then switch between fetch, axios, Python requests, and Node.js http output tabs.
How to use it
Quick steps to get the most out of this utility.
- 1
Paste the curl command
Copy a curl command from terminal, Postman, or browser DevTools and paste it in. Multi-line OK.
- 2
Check the parsed summary
The tool shows the detected method, URL, headers, and body — confirm parsing is correct before copying code.
- 3
Choose a language
Click fetch, axios, Python, or Node to switch code output tabs.
- 4
Copy and use
Click Copy to put the code on your clipboard and paste it into your project.
Why convert cURL?
cURL is the universal language of HTTP — API documentation, browser DevTools, and most backend tools export examples as curl commands. But once you understand the request, you need it in your language of choice. Translating curl flags manually is tedious and error-prone, especially when there are a dozen headers and a JSON body.
Getting curl from browser DevTools
Open DevTools (F12), go to the Network tab, find the request you want to replicate, right-click it, and choose Copy → Copy as cURL. Chrome, Firefox, Edge, and Safari all support this. The exported command includes all cookies, headers, and the request body — paste it here and you get working code in seconds.
Limitations to know
- File uploads (
--form,-F) are not supported yet — the generated code skips form data. - Client certificates (
--cert,--key) are not translated. - No error handling or retry logic is added to the output — it's the minimal happy-path code.
- Cookie jars (
-c,-b FILE) are not yet handled; inline--cookievalues are passed as a Cookie header.
Frequently asked questions
Which curl flags are supported?+
Supported flags: -X / --request (method), -H / --header (headers), -d / --data / --data-raw / --data-binary (body), --data-urlencode (body), -u / --user (Basic auth), --compressed. Unsupported: file uploads (--form, -F), client certificates, --resolve, and most network-tuning flags. These cover the vast majority of real-world API calls.
Does it handle multiline curl commands?+
Yes — backslash-newline line continuations are collapsed before parsing, so you can paste curl commands copied from the terminal or browser DevTools exactly as they appear.
How does Basic authentication work?+
If -u user:password is present, the tool converts it to an Authorization: Basic <base64(user:password)> header in all output languages. In the Python and Node outputs, the base64 encoding is embedded directly so the generated code is self-contained.
Can I trust the generated code in production?+
The generated code is a starting point. Always review it for error handling (no try/catch is added), timeout settings, and your language's idioms for streaming or large payloads. The tool focuses on faithfully converting the curl parameters — adding production robustness is your job.
Why does the axios output use await at the top level?+
The generated code assumes an async context (e.g. inside an async function or a Node module with top-level await enabled). Wrap it in async function main() { ... } main(); if you need it to run in a CommonJS script.
Keep exploring
More utilities and reading from Toolisk.