A SOCKS5 proxy is a proxy that relays network connections without caring what protocol runs inside them. Your application tells the proxy which host and port it wants, the proxy opens that connection, and from then on it simply passes bytes in both directions. Because it works below HTTP, a SOCKS5 proxy can carry web traffic, but also database clients, SSH, mail, game clients or any other TCP-based tool that supports SOCKS. It's defined in RFC 1928, with username and password authentication in RFC 1929.
How the SOCKS5 Handshake Works
- Greeting: the client connects to the proxy and lists the authentication methods it supports, for example no auth and username/password.
- Method selection: the proxy picks one. For a commercial proxy that's username/password.
- Authentication: the client sends the username and password; the proxy replies success or failure.
- Request: the client asks to CONNECT to a destination, given as an IPv4 address, IPv6 address or domain name, plus a port.
- Reply: the proxy connects to the destination and reports success or an error code.
- Relay: the connection is open, and the proxy forwards bytes untouched. For HTTPS, your TLS session runs end to end with the site.
SOCKS5 also defines BIND (for incoming connections, used by old protocols like active FTP) and UDP ASSOCIATE (for relaying UDP). Support for these varies between providers; most commercial use is CONNECT over TCP.
SOCKS5 vs HTTP Proxies
- Protocols: SOCKS5 relays any TCP connection; an HTTP proxy is designed for HTTP and HTTPS (other TCP via CONNECT, if the client supports it).
- Header changes: SOCKS5 never touches your data; an HTTP proxy can add headers to plain HTTP requests. See transparent vs anonymous vs elite proxies.
- DNS: an HTTP proxy always resolves hostnames remotely; with SOCKS5 it depends on the client.
- Support: almost every HTTP tool supports HTTP proxies; SOCKS5 support is common but not universal.
For web scraping both work equally well. SOCKS5 is the natural choice for non-HTTP tools. Full comparison: SOCKS5 vs HTTP proxies.
Remote DNS: socks5 vs socks5h
Step 4 above allows the client to send either an IP or a domain name. If the client resolves the name itself and sends an IP, your DNS lookup happens locally, outside the proxy. That's a DNS leak, and it can also route you to a server meant for your real location. In curl and Python requests, the socks5h:// scheme makes the client send the hostname so the proxy resolves it.
Using a SOCKS5 Proxy in Practice
curl
curl -x socks5h://USERNAME:[email protected]:1080 https://api.ipify.org
# Equivalent, with credentials kept out of the URL
curl --socks5-hostname global.nodeproxies.xyz:1080 --proxy-user "USERNAME:PASSWORD" https://api.ipify.orgPython requests
# pip install "requests[socks]"
import requests
proxy = "socks5h://USERNAME-country-us:[email protected]:1080"
r = requests.get("https://ipinfo.io/json", proxies={"http": proxy, "https": proxy}, timeout=30)
print(r.json()["ip"], r.json()["country"])SSH through SOCKS5
OpenSSH can tunnel through a SOCKS5 proxy with a ProxyCommand, using the nc that ships with macOS and most BSD-based netcat builds. Note that this nc form doesn't send SOCKS credentials, so it only works with SOCKS proxies that don't require authentication, such as a local SSH tunnel on 127.0.0.1.
ssh -o ProxyCommand="nc -X 5 -x 127.0.0.1:1081 %h %p" [email protected]Common SOCKS5 Problems
- Using http:// with the SOCKS port, or socks5:// with the HTTP port: the handshakes don't match and you get confusing errors. On NodeProxies, SOCKS5 is port 1080 and HTTP is 8080.
- Missing SOCKS support in Python: requests needs the socks extra (PySocks) installed.
- Authentication failures: the client may not support RFC 1929 username/password auth, or the credentials contain characters that need URL encoding. See SOCKS5 authentication failed.
- Browsers: Chrome's --proxy-server flag doesn't accept SOCKS credentials, so you need an extension or a local forwarder. See how to set up a proxy in Chrome.
SOCKS4, SOCKS4a and SOCKS5
SOCKS4 supports only IPv4 addresses and no real authentication. SOCKS4a added hostnames so the proxy could resolve DNS. SOCKS5 added username and password authentication, IPv6, UDP relaying and a cleaner negotiation. If a tool offers all three, choose SOCKS5.
Is SOCKS5 Encrypted?
No. SOCKS5 itself doesn't encrypt anything, including the authentication exchange. Your data is protected when the protocol inside is encrypted, as HTTPS, SSH and TLS-based protocols are. For plain-text protocols, assume the path can be observed.
SOCKS5 Proxies From NodeProxies
Every NodeProxies plan supports SOCKS5 on global.nodeproxies.xyz:1080 with the same username options as HTTP: -country-xx for location and -session-{id}-time-{minutes} for sticky IPs. That works across residential, mobile and datacenter. Register, check pricing, or compare options in best SOCKS5 proxies.
FAQ
What is a SOCKS5 proxy used for?
Routing any TCP application through another IP: browsers and scrapers, but also SSH, database clients, mail clients and other tools that support SOCKS.
Is SOCKS5 faster than an HTTP proxy?
The difference is negligible in practice. Speed depends on the exit IP and network, not the proxy protocol.
Does SOCKS5 hide my IP?
Yes, for traffic you send through it. Use remote DNS (socks5h) so hostname lookups don't leave your machine.
What port does SOCKS5 use?
1080 is the conventional default, and it's the SOCKS5 port on NodeProxies. Providers can use any port.
