cURL Converter

Convert a cURL command to code — Python, JavaScript, Java, PHP, Go, Ruby and C#

Right-click a request in DevTools, pick "Copy as cURL", paste it here — and get the same request as working code in Java, JavaScript, Python, PHP, Go, Ruby or C#. The URL, method, headers, cookies and body carry over as they are, so a scraper starts from exactly what the browser sent. Parsing and code generation run in your browser: a command holding a session cookie or a bearer token never leaves the machine.

cURL command
Language
Generated code
Paste a cURL command above — the code appears here…

How to use

  1. 1Copy the request as cURLIn Chrome or Firefox DevTools open Network, right-click the request → Copy → Copy as cURL. Windows Chrome offers two flavours, bash and cmd — both are understood, including the cmd one with its caret (^) escaping.
  2. 2Paste the commandOne line or many, with or without backslash line breaks. Postman, Insomnia and most API docs export the same format.
  3. 3Pick a language and clientJava, JavaScript, Python, PHP, Go, Ruby or C#. Where a language has more than one common client, the Client list holds them: java.net.http, OkHttp or Apache HttpClient for Java; fetch or axios for JavaScript.
  4. 4Copy the codeImports, the header map and the request body are already filled in — the snippet runs as it stands, with no placeholders to replace.
  5. 5Check it still worksA copied request carries the cookies it had at that moment. If the code answers 403 where cURL answered 200, send the same request through Request Tester and see what the server actually replies.

Examples

curl to Python (requests)
curl -X POST … -d '{"q":1}' → requests.post(url, headers=headers, data=data)
A requests script with the headers dict and the body already assembled, ending in print(response.text).
curl to JavaScript (fetch)
const options = { method: "POST", headers: {…}, body: "…" } → fetch(url, options)
Plain fetch, no dependencies — runs on Node 18+ and in the browser. Switch the client to axios if that is what the project already uses.
curl to Java (java.net.http)
HttpRequest.newBuilder().uri(URI.create(url)).method("GET", …).build()
A complete Main class on the JDK client, no third-party library. OkHttp and Apache HttpClient 5 are one dropdown away.
Headers become a header map
-H 'Authorization: Bearer eyJ…' → .header("Authorization", "Bearer eyJ…")
Every -H carries over verbatim — Authorization, Referer, the long Chrome User-Agent, the sec-ch-ua set. Nothing is dropped or reordered.
Cookies stay a Cookie header
-b 'sid=8f2c…; lang=en' → "Cookie": "sid=8f2c…; lang=en"
The -b flag folds into a normal Cookie header, which is what a scraping session usually needs.
Basic auth turns into a header
-u admin:secret → "Authorization": "Basic YWRtaW46c2VjcmV0"
The pair is base64-encoded during conversion, so the generated code needs no separate auth call.
Windows cmd format
curl ^"https://example.com^" -H ^"Accept: */*^"
Copy as cURL (cmd) escapes with carets and doubles the quotes. Paste it as it is — no cleanup needed.

When to use for web scraping

You have a request that already works — from DevTools, Postman or an API doc — and you need it as code. Retyping the URL, the method, fifteen headers and a JSON body by hand is slow and gets a character wrong sooner or later. Pasting the command does not. In scraping this is usually the first step. Find the request that returns the data in the Network tab, copy it as cURL, convert it to Python or Node, and the script starts from the exact headers and cookies the server expects — not from a guess about what it might want. When the response comes back wrong, Request Tester sends the same request through a proxy and shows the raw answer, and Proxy Checker tells you whether the proxy itself is the problem. Everything is computed locally. That matters more here than on most tools: a copied request usually contains a live session cookie or an access token, and those stay in the browser tab.

FAQ

How do I convert a cURL command to Python?
Paste the command and pick Python. You get a requests script with url, a headers dict, the body if there is one, and the matching requests.get / requests.post call — ready to run, nothing to fill in.
Can I convert cURL to Node.js?
Yes. Pick JavaScript, then fetch or axios in the Client list. fetch needs no dependencies on Node 18 and up and works in the browser too; axios is there for projects that already use it. Headers and the request body are included either way.
Which Java HTTP client does it support?
Three, and you choose: java.net.http.HttpClient — built into Java 11+, zero dependencies; OkHttp; and Apache HttpClient 5. The output is a full Main class, so it compiles and runs on its own.
What about PHP, Go, Ruby and C#?
All four are there. PHP generates ext-curl code (curl_init / curl_setopt), Go and Ruby use their standard net/http, C# uses HttpClient. Each of these has a single common client, so no Client list appears for them.
What does "Copy as cURL (bash)" mean, and how is it different from the cmd version?
They are the same request written for two different shells. The bash flavour quotes with single quotes and breaks lines with a backslash. The cmd flavour, offered by Chrome on Windows, escapes with a caret (^) and doubles the quotes instead, because cmd.exe reads a single quote as an ordinary character. Paste either one — the parser handles both, so you do not need to know which you copied.
How do I read a cURL command someone sent me, without running it?
Paste it in and read the generated code instead of the command. A long cURL line is hard to follow: the URL, twenty headers and the body run together on one line. The code pulls them apart — method, headers as a list, body as its own string — so you can see what the request does before sending it anywhere. Conversion sends nothing.
What happens to --data-raw, -F and --compressed?
--data-raw, --data, --data-binary and --data-urlencode all become the request body. -F (multipart) is simplified and the tool warns you about it — check the generated body before using it. Flags that only control the cURL binary itself — --compressed, -L, -k, -s, -v — are accepted and left out of the code, since HTTP libraries handle redirects and compression their own way. -x / --proxy is dropped too: choose the proxy in Request Tester, where it is a real setting.
Does the conversion happen on a server?
No. Parsing and code generation run entirely in the browser tab. A cURL command copied from DevTools usually holds a session cookie or a bearer token, and neither is sent anywhere.
The cURL command works but the converted code gets 403 — why?
Almost always the request is fine and something around it is not. Cookies copied an hour ago may have expired. Some protections also look below HTTP, at the TLS handshake, and a Python or Java client has a different fingerprint from Chrome — so identical headers can still read as a different client. Send the request through Request Tester to compare the answers, and check the proxy in Proxy Checker if the traffic goes through one.

Related tools