Skip to content

cURL converter

Paste a curl command, such as one copied from your browser's developer tools, and get the same request as Python requests, Python httpx, Node.js fetch, Playwright for Python or Go net/http. Headers, cookies, the body, basic auth, redirects, TLS checks, timeouts and proxy settings carry over.

Bash syntax, as Copy as cURL writes it.

Conversion runs in your browser. The command, with any cookies or tokens in it, is not sent to TrueProxies or anywhere else.

import requests

cookies = {
    "session": "abc123",
    "theme": "dark",
}

headers = {
    "accept": "application/json",
    "content-type": "application/json",
}

json_data = {
    "query": "proxy",
    "limit": 20,
}

response = requests.post(
    "https://httpbin.org/anything?page=1",
    cookies=cookies,
    headers=headers,
    json=json_data,
    allow_redirects=False,
)
print(response.status_code)
print(response.text)

Copy a request as cURL from your browser

Chrome and Edge
Open DevTools (F12, or Cmd+Option+I on a Mac), select Network and reload the page. Right-click the request, then choose Copy, Copy as cURL. On Windows, pick Copy as cURL (bash): the cmd version uses Windows quoting.
Firefox
Open the Network tab (Ctrl+Shift+E, or Cmd+Option+E on a Mac) and reload. Right-click the request, then choose Copy Value, Copy as cURL. On Windows, pick the POSIX version.
Safari
Turn on Show features for web developers in Settings, Advanced. Open Develop, Show Web Inspector, select Network and reload. Control-click the request and choose Copy as cURL.

A copied command carries your cookies and any authorization header. Whoever has it can act as you on that site until the session ends, so share it only with the secrets removed.

What each version does with cookies, redirects and TLS checks

Each output behaves like the curl command, not like the library's defaults: redirects are followed only when the command has -L, and certificate checks are off only with -k.

OutputCookiesRedirectsTLS checks (-k)Timeout (-m)
Python requestsA cookies dict passed as cookies=requests follows them by default, so the code adds allow_redirects=False unless the command has -Lverify=Falsetimeout= limits the connection and each read, not the whole request
Python httpxA cookies dict set on the ClientNot followed by default; -L adds follow_redirects=Trueverify=False on the Clienttimeout= on the Client; without -m, httpx waits 5 seconds per step
Node.js fetchA Cookie headerfetch follows them by default, so the code adds redirect: 'manual' unless the command has -LAn undici Agent with rejectUnauthorized: falseAbortSignal.timeout() for the whole request
Playwright for Pythoncontext.add_cookies() for the URLThe browser always follows themignore_https_errors=True on the contexttimeout= on page.goto(), in milliseconds; 30 seconds when unset
Go net/httpA Cookie headerGo follows up to 10 by default, so the code returns http.ErrUseLastResponse from CheckRedirect unless the command has -LInsecureSkipVerify: true in tls.ConfigClient.Timeout for the whole request

The code leaves out Accept-Encoding, Content-Length and connection headers such as Connection and TE. Each library sets these for what it can send and decode, and all five decompress gzip responses, so --compressed needs no code. A copied browser request usually asks for Brotli and zstd too, which requests and httpx decode only when the brotli or zstandard package is installed.

Proxy settings in each library

With Route through a proxy on, every output gets proxy settings in that library's own form, with USER, PASS and HOST:PORT placeholders. A proxy set in the command with -x is used as written. The main difference between libraries is who resolves the hostname behind a SOCKS5 proxy.

curl
-x socks5h:// sends the hostname to the proxy, which resolves it. -x socks5:// resolves it on your machine and sends the proxy an IP address.
Python requests
Same two schemes as curl, with the same meaning. SOCKS needs pip install "requests[socks]".
Python httpx
SOCKS needs pip install "httpx[socks]". httpx accepts socks5:// and socks5h:// and sends the hostname to the proxy with either.
Node.js fetch
The proxy goes in an undici ProxyAgent passed as dispatcher. HTTP and HTTPS proxies work in every undici version; socks5:// needs undici 7 or later, where it is marked experimental, and sends the hostname to the proxy.
Playwright for Python
The proxy goes in the launch options. There is no socks5h://: with socks5:// the browser sends the hostname to the proxy. Playwright refuses a username and password on a SOCKS proxy, so use an HTTP proxy when the proxy needs a password.
Go net/http
http.ProxyURL on the Transport takes http, https, socks5 and socks5h. Go treats socks5 like socks5h: the proxy resolves the hostname.

A username or password inside a proxy URL must be percent-encoded: p@ss:word becomes p%40ss%3Aword. The converter encodes credentials it takes from -U; credentials already in a -x URL are kept as written.

On TrueProxies Residential IPv4, targeting goes in the username after a hyphen: USER-country-us asks for a US IP, and USER-country-us-session-abc123 asks for the same IP on every request with that session ID. The password stays the same. Which options each product accepts is listed in the username options table.

Supported curl options

-X, --request
Method
-H, --header
Header; Cookie headers become cookies
-d, --data, --data-raw, --data-binary
Body, joined with & when repeated; POST unless -X says otherwise
--data-urlencode
Body part, encoded as curl encodes it
--json
Body with JSON content type and Accept headers
-u, --user
Basic authentication
-b, --cookie
Cookies (a cookie file is not read)
-A, --user-agent and -e, --referer
User-Agent and Referer headers
-L, --location
Follow redirects
-k, --insecure
Skip certificate checks
--compressed
Accepted; every library decompresses on its own
-x, --proxy, -U, --proxy-user, --socks5, --socks5-hostname
Proxy and proxy login
-G, --get
Move the body into the query string
-I, --head
HEAD request
-m, --max-time
Timeout in seconds
--url
URL

Any other option is named in a note under the input with its value, so you can add it by hand. The command can use single quotes, double quotes with backslash escapes, $'…' strings and backslash line breaks.

Limitations

  • Bash syntax only. Commands copied as cURL (cmd) or for PowerShell use other quoting.
  • One request: the first curl command and its first URL. Anything after an unquoted ;, |, & or > is ignored.
  • Shell variables such as $TOKEN and command substitutions are kept as text, not expanded.
  • Not converted: multipart forms (-F), uploads (-T), bodies or cookies read from a file (@file, -b file), client certificates, and HTTP version or retry options.
  • The Python and Node.js outputs rebuild JSON bodies from the parsed data, so spacing can differ from the original. Go sends the body exactly as written.
  • Playwright loads the URL as a page in a real browser. The browser adds its own headers and, for an HTML page, loads its images and scripts too.

cURL converter questions

How do I convert a curl command to Python?

Paste the command into the converter and open the Python requests or Python httpx tab. Headers, cookies, the body, basic auth, -k and -m carry over, and redirects are followed only if the command has -L, as in curl. Install the library with pip install requests or pip install httpx and run the code.

Is my curl command sent to a server?

No. Parsing and code generation run as JavaScript in your browser, so cookies and tokens in a copied command stay on your device.

Why does the converter list some options as not converted?

It converts the options that shape an HTTP request: method, headers, body, cookies, authentication, redirects, TLS checks, compression, proxy and timeout. Others, such as -o, -v or -F, are named in a note under the input with their values, so nothing is dropped without a mention.

How do I send the converted request through a proxy?

Turn on Route through a proxy. Each output gets settings with USER, PASS and HOST:PORT placeholders in its own form: proxies= for requests, proxy= for httpx, an undici ProxyAgent for Node.js fetch, launch options for Playwright and http.ProxyURL for Go. If the command already has -x, that proxy is used instead.

Should I use socks5 or socks5h?

In curl and Python requests, socks5h sends the hostname to the proxy, which resolves it, while socks5 resolves it on your machine first. Use socks5h with a geo-targeted proxy so the lookup happens in the exit's region and your own DNS resolver never sees the hostname. httpx, undici, Playwright and Go send the hostname to a SOCKS5 proxy with either scheme.

Does it work with Windows cmd or PowerShell commands?

No. It reads bash quoting. In Chrome or Edge on Windows, choose Copy as cURL (bash); in Firefox, choose the POSIX version.