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)import httpx
cookies = {
"session": "abc123",
"theme": "dark",
}
headers = {
"accept": "application/json",
"content-type": "application/json",
}
json_data = {
"query": "proxy",
"limit": 20,
}
with httpx.Client(
cookies=cookies,
) as client:
response = client.post(
"https://httpbin.org/anything?page=1",
headers=headers,
json=json_data,
)
print(response.status_code)
print(response.text)// Node.js 18 or later. Save as request.mjs and run: node request.mjs
const response = await fetch('https://httpbin.org/anything?page=1', {
method: 'POST',
headers: {
'accept': 'application/json',
'content-type': 'application/json',
'Cookie': 'session=abc123; theme=dark',
},
body: JSON.stringify({
query: 'proxy',
limit: 20,
}),
redirect: 'manual',
});
console.log(response.status);
console.log(await response.text());from playwright.sync_api import sync_playwright
url = "https://httpbin.org/anything?page=1"
headers = {
"accept": "application/json",
"content-type": "application/json",
}
post_data = "{\"query\":\"proxy\",\"limit\":20}"
with sync_playwright() as p:
browser = p.chromium.launch()
context = browser.new_context()
context.add_cookies([
{"name": "session", "value": "abc123", "url": url},
{"name": "theme", "value": "dark", "url": url},
])
page = context.new_page()
# The page's first request is the URL itself: send it with curl's method, headers and body.
page.route(
"**/*",
lambda route: route.continue_(
method="POST",
headers={**route.request.headers, **headers},
post_data=post_data,
),
times=1,
)
response = page.goto(url)
print(response.status)
print(response.text())
browser.close()package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{
// curl follows redirects only with -L.
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
body := strings.NewReader(`{"query":"proxy","limit":20}`)
req, err := http.NewRequest("POST", "https://httpbin.org/anything?page=1", body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("accept", "application/json")
req.Header.Set("content-type", "application/json")
req.Header.Set("Cookie", "session=abc123; theme=dark")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
respBody, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(respBody))
}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.
| Output | Cookies | Redirects | TLS checks (-k) | Timeout (-m) |
|---|---|---|---|---|
| Python requests | A cookies dict passed as cookies= | requests follows them by default, so the code adds allow_redirects=False unless the command has -L | verify=False | timeout= limits the connection and each read, not the whole request |
| Python httpx | A cookies dict set on the Client | Not followed by default; -L adds follow_redirects=True | verify=False on the Client | timeout= on the Client; without -m, httpx waits 5 seconds per step |
| Node.js fetch | A Cookie header | fetch follows them by default, so the code adds redirect: 'manual' unless the command has -L | An undici Agent with rejectUnauthorized: false | AbortSignal.timeout() for the whole request |
| Playwright for Python | context.add_cookies() for the URL | The browser always follows them | ignore_https_errors=True on the context | timeout= on page.goto(), in milliseconds; 30 seconds when unset |
| Go net/http | A Cookie header | Go follows up to 10 by default, so the code returns http.ErrUseLastResponse from CheckRedirect unless the command has -L | InsecureSkipVerify: true in tls.Config | Client.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.
More free tools
See all tools- Proxy cost calculatorCompare per-GB, per-run unlimited, monthly unlimited and traffic-pack costs using your own numbers.Open tool
- Proxy CheckerQueue up to 1,000 HTTP, HTTPS, SOCKS5, or SOCKS5H endpoints for progressive connectivity, target-response, cold response-time, exit-IP, and location evidence.Open tool
- IP Leak TestInspect browser-visible IPv4, IPv6, WebRTC candidates, and DNS-location indicators against a known baseline.Open tool
- IPv6 TestCheck whether a target website actually works over IPv6, including every embedded host it depends on, because one IPv4-only resource breaks the page.Open tool