How to Set Up Proxies in cURL
Route cURL traffic through an authenticated proxy in a few lines. Copy the code below and swap in your credentials.
Quick answer
Set the proxy in the format http://user:pass@host:port or socks5h://user:pass@host:port and send your cURL request through it. Full code below.
cURL proxy example
curl -x "http://user:pass@host:port" https://httpbin.org/ip
# SOCKS5 with remote DNS
curl -x "socks5h://user:pass@host:port" https://httpbin.org/ipThe -x/--proxy flag takes the full authenticated URL, and you can alternatively pass credentials with -U user:pass to keep them out of the visible URL. Use the socks5h scheme (not socks5) when you want DNS resolved on the proxy side, which prevents local DNS leaks. curl is the fastest way to smoke-test whether a proxy endpoint and its credentials are live before wiring it into code.
Rotating proxies
cURL works cleanly with rotating backconnect endpoints — point it at a single gateway host and the provider rotates the exit IP for you.
Best proxies to use with cURL
Cheapest-Proxies.com EDITOR'S CHOICE
4.9Best overall value across every proxy type and use case · flexible pay-as-you-go plans
Visit Cheapest-Proxies.comBright Data
4.6Enterprise-grade proxy and web data platform · from ~$8-9/GB (residential, volume-dependent)
Read Bright Data reviewOxylabs
4.6Premium enterprise proxies and scraper APIs · from ~$8/GB (residential, volume-dependent)
Read Oxylabs reviewSmartproxy
4.5User-friendly proxies with excellent price-to-performance · from ~$3.50-7/GB (residential)
Read Smartproxy reviewOur #1 pick is a sponsored partner. Remaining providers are ranked editorially by rating and value.
Frequently Asked Questions
Does cURL support authenticated proxies?
Yes. Provide the username and password (as a URL or separate fields) and cURL handles the auth handshake.
Can cURL rotate proxies automatically?
Yes — point it at a rotating backconnect endpoint and the provider rotates IPs for you.
How do I add a proxy in cURL?
Supply the proxy as http://user:pass@host:port or socks5h://user:pass@host:port and pass it to cURL as shown in the code above.
What proxies work best with cURL?
Residential or rotating proxies from a reliable provider give the best success rate for CLI projects.
Related Guides
Best proxies for cURL
We compared 40+ providers on price, coverage, and reliability — this one offered the best overall value.
Visit Cheapest-Proxies.com