Log in Sign up
cURL to code

Convert a cURL command to Python, Node.js or PHP code

In your browser DevTools, right-click a request, choose Copy as cURL and paste it here. The converter reads the URL, headers, cookies and body and builds code with your proxy.

Language

The proxy field overrides -x from the command. For SOCKS5 the code includes the install line for the package you need.

A cURL command from the terminal turns into ready code

How the converter works

The converter reads the options browsers put into Copy as cURL: -X, -H, --data-raw, --data-binary, -b, -u, -x, -k, -L, --compressed and line breaks from bash and Windows.

Set the proxy in the command with -x or in a separate field. SOCKS5 needs requests[socks] in Python and socks-proxy-agent in Node.js, and the converter adds the install line.

When it helps

  • You need your scraper to repeat a request exactly the way the browser sends it.
  • You move a request from Postman or DevTools into a script and do not want to retype headers.
  • You check that a site answers through a proxy the same way it does directly.
  • You learn requests or axios on a live example of your own request.

Questions and answers

01How do I copy a request as cURL?

In Chrome, Edge or Firefox open DevTools, go to Network, find the request, right-click it and choose Copy, then Copy as cURL. On Windows pick the (bash) variant, it is cleaner.

02Does the command go to your server?

No. Parsing and code generation run in your browser, and neither the command nor the proxy goes anywhere.

03Why does the code not follow redirects?

curl without -L does not follow redirects, and the converter keeps that behaviour. Add -L to the command and the code will follow them.

04How do I set a proxy?

With the -x flag in the command, such as -x socks5h://ip:port, or in the separate field below it. Put the login and password as user:pass@ before the address. For SOCKS5 the converter adds the install line for the package.

05What should I remove from a copied command before sharing the code?

The cookie and authorization headers and the -b flag. A command from DevTools carries your session cookies and tokens, and anyone can log in to your account with them.

Pricing Grab a free hour