A SOCKS5 proxy passes network connections between your device and a destination without caring what's inside them. Where an HTTP proxy understands web requests, SOCKS5 works one level lower and relays raw TCP streams, so it suits web browsers, scrapers, chat apps and most other software with a proxy setting. The protocol is defined in RFC 1928, and the username and password login it uses is described in RFC 1929. This guide covers how it differs from HTTP, why the DNS setting matters, and how to connect from the command line and from Python.
SOCKS5 proxy vs HTTP proxy
| HTTP(S) proxy | SOCKS5 proxy | |
|---|---|---|
| Works at | The HTTP layer | Below HTTP, at the connection level |
| Carries | Web traffic, with HTTPS sent through a CONNECT tunnel | Any TCP traffic, and UDP where the server supports it |
| Reads requests | Can see and change plain HTTP requests | Passes bytes through without interpreting them |
| Login | A Proxy-Authorization header |
Username and password during the handshake |
| DNS | The proxy resolves the hostname | Your choice: on your device or at the proxy |
| Best for | Browsers, scrapers, HTTP libraries | Non-web apps, mixed traffic, tools that only speak SOCKS |
Neither protocol encrypts your data. When you request an https:// URL, the encryption comes from TLS between your client and the website, and it works the same way over either kind of proxy.
For most web scraping, the HTTP endpoint is the simpler choice, because every HTTP library supports it. SOCKS5 earns its place when your software speaks SOCKS but not HTTP proxies, when you need to tunnel something that isn't HTTP, or when you want control over where DNS lookups happen. All our proxies support both protocols, and the HTTP and SOCKS5 doc explains how to connect with each.
What happens during the handshake
Before any of your data moves, the client and the proxy agree on a few things:
- Your client connects to the proxy and lists the login methods it supports.
- The proxy picks one. With our proxies, that's username and password.
- The client sends the username and password, and the proxy accepts or rejects them.
- The client asks the proxy to connect to a destination, given as an IP address or a hostname, plus a port.
- The proxy opens that connection and confirms. From then on it simply relays bytes in both directions.
The username and password in step 3 travel unencrypted, just as HTTP proxy logins do. Treat proxy credentials like any other password, and keep them out of code you share.
Where DNS happens: socks5 vs socks5h
When your app connects to example.com through SOCKS5, something has to turn that name into an IP address. SOCKS5 lets either side do it:
- socks5 means your device looks up the hostname with its own DNS server and hands the proxy a bare IP address.
- socks5h means your device sends the hostname itself and lets the proxy resolve it. The "h" stands for hostname.
Remote resolution is usually what you want. Your local DNS server never learns which sites you connect to, and the lookup happens where the exit IP is. That second point matters more than it sounds. Many large sites answer a DNS query with the address of a server near whoever asked, so a local lookup can point a proxied request at a server far from the exit IP. You get slower responses and, sometimes, the wrong regional version of a page. Local resolution is mostly useful for debugging, or when you deliberately want to pin a specific IP.
If you use a browser with a SOCKS5 proxy, run a DNS leak test after you connect. If the DNS servers it lists belong to your own internet provider rather than the proxy's network, your lookups are happening locally.
Connecting with curl
curl supports both schemes in the proxy URL. Replace the placeholders with the details from your dashboard:
# The proxy resolves the hostname (recommended)
curl -x socks5h://USERNAME:PASSWORD@HOST:PORT https://example.com
# Your machine resolves the hostname
curl -x socks5://USERNAME:PASSWORD@HOST:PORT https://example.com
If your password contains characters such as @, : or /, percent-encode them in the URL, so @ becomes %40. Our curl guide has more examples, including how to check which IP a site sees.
Connecting with Python
The popular requests library needs its SOCKS extra installed first:
pip install "requests[socks]"
Then pass the proxy for both schemes:
import requests
proxy = "socks5h://USERNAME:PASSWORD@HOST:PORT"
proxies = {"http": proxy, "https": proxy}
response = requests.get("https://example.com", proxies=proxies, timeout=30)
print(response.status_code)
Use socks5h:// here too if you want the proxy to resolve hostnames. If your password includes special characters, encode it with urllib.parse.quote(password, safe="") before you build the URL. The Python guide has more patterns for real projects.
Browsers and desktop apps
Support for SOCKS5 with a password varies a lot outside the command line:
- Chrome's built-in proxy settings don't support SOCKS5 username and password authentication. You can point Chrome at a SOCKS5 proxy that needs no login, but an authenticated one won't work there. In Chrome, use the HTTP(S) endpoint instead, or a browser profile tool that handles authenticated SOCKS5 itself. Our antidetect browsers guide covers that kind of setup.
- Many desktop apps, including chat clients such as Telegram, accept a SOCKS5 host, port, username and password directly in their settings.
- Command-line tools and libraries usually take a single proxy URL, as in the examples above.
When an app offers both SOCKS4 and SOCKS5, pick SOCKS5. SOCKS4 has no password login and no IPv6 support.
When a static IP makes SOCKS5 more useful
SOCKS5 is often used for long-lived connections: a chat client that stays online all day, a remote desktop session, a monitoring or trading tool that holds a socket open for hours. Those apps behave best when the address on the other end doesn't change. A rotating pool would hand them a new IP whenever they reconnect, which can trigger security checks or break a session that expects one location.
That's where a static residential proxy fits. You get one residential IP that stays the same for the whole 30-day period, reachable over SOCKS5 or HTTP(S) with your username and password. Pricing is per IP, from $2.00/IP on larger packages, and you pay as you go without a subscription.
If your SOCKS5 traffic is short and spread across many sites, such as a scraper that never reuses a connection, a rotating residential plan billed per GB may suit it better. The protocol is the same either way, so switching later doesn't mean rewriting your code.