🌀 cURL ⇄ fetch / axios / wget Converter
Convert cURL commands to HTTP request code in various languages and libraries. Headers, cookies, and body are all preserved.
Supported cURL Options
🔗 Related Tools
📖 Where people get stuck
Converts a cURL command into thirteen forms of code: fetch, axios, Python requests, PHP, Go, Rust, wget, HTTPie and more. Headers, cookies and body are preserved verbatim, and everything runs in the browser. Preserving things verbatim is the value of this tool and simultaneously its biggest caveat — a cURL copied from browser DevTools carries your logged-in session with it. And many of the headers the browser was sending are not headers your code should send. A conversion that succeeds yet does not work when pasted is usually one of those two things.
| Case | What happens | What to do |
|---|---|---|
| The copied cURL carries your credentials verbatim | The Copy as cURL command in DevTools writes out every header the request actually sent — your session ID sits in the Cookie header and your access token in Authorization, both in plain text. That string is enough to log in as you. What makes it dangerous is that this cURL takes a form that invites sharing: you paste it into a ticket as reproduction steps, send it to a colleague on Slack, put it in a blog post, or paste it into an AI to ask why it does not work. Every one of those exports a live session. And because it looks like just another fragment of a long command, the person pasting it does not notice. |
Delete the Cookie and Authorization lines before sharing. This page runs entirely in your browser, so pasting here is itself safe, but the generated code contains the same values — the problem returns the instant you copy that output somewhere else. In practice, if you are writing code that calls an API, rebuild the authentication yourself first — the correct form uses an API key or a service account issued for that API, not your browser session cookie. If you have already shared one, invalidate that session by logging out or rotating the token — "probably nobody looked" is not a remedy. |
| Carrying the browser headers straight into your code | The headers DevTools copies include many that are the browser concerns rather than the API concerns — sec-ch-ua, sec-fetch-mode, Accept-Encoding, Connection, Content-Length, Host, Referer and so on. These belong to the HTTP client to manage automatically, and setting them by hand breaks things: carry over a fixed Content-Length and it desynchronizes the moment you change the body, and state Accept-Encoding: gzip explicitly and some libraries stop decompressing, handing you raw compressed bytes. When running in a browser there is more: Origin, Referer, Cookie and others are forbidden headers, so fetch silently drops them — no error is raised, so behavior changes while you believe you set them. |
After converting, strip the headers down to a minimum. What you actually need is usually just five things: method, URL, Content-Type, authentication and body. Cut first, run, and put back only what breaks — doing it in that order tells you which headers are genuinely required. User-Agent is the one that occasionally is, because some APIs reject default values. And if you are running in a browser, check CORS first — cURL sits outside the same-origin policy, so a request that succeeds in cURL failing under fetch is normal. That is a server-side Access-Control-Allow-Origin problem, not a code problem, and no amount of fixing the conversion will resolve it. |
| Shell quoting silently changes the body | A cURL command sits on top of shell syntax, so the same command delivers different content depending on the shell. Windows cmd.exe does not treat single quotes as quoting, so -d '{"a":1}' arrives at the server with the quote characters included. In PowerShell 5.1, curl is an alias for Invoke-WebRequest, so the cURL options do not apply at all. A body containing non-ASCII text is worse still: sent from bash on Windows, some environments encode it in the local codepage rather than UTF-8 — it shows up as mojibake on the server while the command reports success. And one more: -d treats a value starting with @ as a filename, and it also strips newlines — paste formatted JSON and it is flattened to a single line. |
Put the body in a file and send it with --data-binary @body.json. --data-binary sends newlines and byte encoding exactly as they are, leaving no room for the shell to intervene — for testing JSON containing non-ASCII text, this is the only reliable method. On Windows, writing curl.exe with the extension launches the real cURL even from PowerShell. More fundamentally, cURL is a tool for running something once to check it, not for a procedure you repeat — if you are recording a procedure, commit the converted code instead. Code can be diffed, reviewed and tested. |
What gets converted is a single request. Much of what real API use requires does not appear in a cURL command at all — retries, timeouts, handling rate limits, paging, error handling, connection reuse. Drop the generated code into production as-is and all of that is missing. Timeouts especially: the defaults differ enormously between languages and some wait forever, so always set one explicitly. Another: cURL does not follow redirects by default (it needs -L) while many HTTP libraries do — a standard reason the same URL appears to behave differently. And take particular care when converting a cURL that carries -k or --insecure: that option disables TLS certificate verification, and carrying it into production leaves you defenceless against a machine-in-the-middle. Fix the cause of a certificate error rather than turning verification off.
📖 How to Use
-
1
Copy from DevToolsIn Chrome/Firefox DevTools Network tab, right-click any request → Copy as cURL.
-
2
Paste the cURLPaste the cURL command. Multi-line backslash-continued commands are handled.
-
3
Pick target languageChoose from 13 targets: fetch, axios, Python requests, Go net/http, etc. Headers, cookies, body are preserved.
❓ Frequently Asked Questions
Is it fully compatible with DevTools Copy as cURL?
I want urllib instead of requests for Python
How is multipart/form-data (-F) handled?
How should I manage the Authorization token?
🐛 Found a bug or issue with this tool?
Free to use, no signup. Even just the steps to reproduce are helpful. Reports go directly to the operator and help us fix issues.
Thanks for your report!
Your report has been delivered to the operator and will be used to improve the tool.