Comparison5 min read

SOCKS4 vs SOCKS5

Short answer

SOCKS5 is the newer version of the SOCKS proxy protocol and adds what SOCKS4 lacks: password authentication, IPv6 addresses, host names resolved by the proxy, and UDP relaying. SOCKS4 carries TCP connections to IPv4 addresses only, with no real authentication, so SOCKS5 is the right choice for almost every use today, and SOCKS4 matters only for old software. ProxyField supports SOCKS5, alongside HTTP and HTTPS, on 412M+ residential IPs from $1.95/GB; start with the Easy Trial: 1 GB for $2.95.

residential IPs
412M+
from, traffic never expires
$1.95/GB
Easy Trial
1 GB for $2.95
On this page 7 sections
  1. SOCKS4 vs SOCKS5 in one table
  2. What SOCKS4 does
  3. SOCKS4a: host names through the proxy
  4. What SOCKS5 adds
  5. How to pick the version in your client
  6. Which should you use?
  7. SOCKS4 vs SOCKS5 FAQ

SOCKS4 vs SOCKS5 in one table

Both versions do the same basic job: relay a TCP connection from your app through the proxy's IP, without reading the data. SOCKS5 adds everything a modern network needs around that job.

FeatureSOCKS4SOCKS4aSOCKS5
SpecificationInformal document, early 1990sInformal extension of SOCKS4RFC 1928, March 1996
AuthenticationA user ID string, no passwordA user ID string, no passwordUsername and password (RFC 1929), GSS-API, or none
Destination addressesIPv4 onlyIPv4, or a host nameIPv4, IPv6, or a host name
Who resolves host namesThe clientThe proxy, if given a nameThe proxy, if given a name
TCP connectionsYesYesYes
Incoming connections (BIND)YesYesYes
UDPNoNoYes (UDP ASSOCIATE), if the server supports it
Support todayLegacy apps, some free listsLegacy appsBrowsers, curl, libraries, proxy services

What SOCKS4 does

SOCKS4 was written in the early 1990s to let programs inside a company network reach the internet through a firewall (SOCKS 4 protocol). A client sends one short request with the version number 4, the command (connect or bind), the destination port, the destination IPv4 address and a user ID string. The proxy answers with "granted" or "rejected" and then relays bytes.

That design has three limits that matter now:

  • No password. The user ID is a plain label the server may check against an ident service; it is not a credential. Paid proxy services cannot authenticate customers with it, so SOCKS4 proxies are usually open or protected only by an IP allowlist.
  • IPv4 only. There is no field for an IPv6 address.
  • The client resolves host names. It must look up the site's IP itself before it connects, so the DNS lookup happens on your machine and your own resolver sees it.

SOCKS4a: host names through the proxy

SOCKS4a is a small extension that fixes the DNS limit (SOCKS 4A). The client sends a dummy IP address of the form 0.0.0.x and adds the host name after the user ID, and the proxy resolves the name itself. It changes nothing else: still no password, no IPv6, no UDP.

Easy Trial: 1 GB for $2.95.
Try for the price of 1 GB, no subscription, traffic never expires.

What SOCKS5 adds

SOCKS5 is a new protocol, published as RFC 1928 in 1996, not an extension. It starts with a negotiation step: the client lists the authentication methods it supports, the server picks one, and only then does the client send its request. Compared with SOCKS4, it adds:

  • Real authentication: username and password (RFC 1929), GSS-API, or no authentication, chosen in the handshake.
  • Address types: IPv4, IPv6 or a domain name, so the proxy can resolve names and reach IPv6 sites.
  • UDP ASSOCIATE: a command for relaying UDP datagrams, used for DNS, voice, games and QUIC, where the server supports it.
  • Clearer replies: error codes that say why a connection failed, such as "host unreachable" or "connection refused".

What SOCKS5 does not add is encryption. Like SOCKS4, it relays traffic as it is; HTTPS sites stay encrypted by their own TLS, and the hop to the proxy, credentials included, is not encrypted. More on this in SOCKS5 vs HTTP proxy.

How to pick the version in your client

Most tools choose the version by the scheme of the proxy URL. In curl and many libraries:

SchemeVersionHost names resolved by
socks4://SOCKS4Your machine
socks4a://SOCKS4aThe proxy
socks5://SOCKS5Your machine
socks5h://SOCKS5The proxy
Shell
# SOCKS5 with a password, DNS resolved by the proxy
curl -x socks5h://<login>:<password>@gate.proxyfield.io:7000 https://api.ipify.org

SOCKS5 port at ProxyField: the same gate.proxyfield.io:7000 as HTTP and HTTPS; SOCKS5 with a username and password: yes, with the same username and password as HTTP. A client set to socks4:// cannot pass a password, so it cannot use a password-protected SOCKS5 service; switch the scheme instead. More in curl with a proxy.

Which should you use?

Use SOCKS5. It does everything SOCKS4 does, and it is the version proxy services, browsers and libraries support with credentials. Choose SOCKS4 or SOCKS4a only when an old program offers nothing else, and then prefer an IP allowlist to protect the proxy, since SOCKS4 has no password.

For web scraping, the choice between SOCKS5 and HTTP(S) matters more than the SOCKS version: most scrapers use HTTP proxies, and SOCKS5 suits apps that are not web clients. Buying options are on SOCKS5 proxies.

Need SOCKS5 on residential IPs? ProxyField residential proxies run over SOCKS5, HTTP and HTTPS on 412M+ IPs in 195+ countries, from $1.95/GB with no subscription. Start with the Easy Trial: 1 GB for $2.95. Traffic never expires, and all purchases are final.

SOCKS4 vs SOCKS5 FAQ

What's the difference between SOCKS4 and SOCKS5?

ProxyField supports SOCKS5 on 412M+ residential IPs, from $2.95/GB for 1 GB down to $1.95/GB, and the difference between SOCKS4 and SOCKS5 is that SOCKS5 adds password authentication, IPv6, host names resolved by the proxy and UDP relaying. SOCKS4 relays TCP to IPv4 addresses only.

Which is better, SOCKS4 or SOCKS5?

SOCKS5, for almost every use: it does everything SOCKS4 does and adds authentication, IPv6, remote DNS and UDP. SOCKS4 is only worth using when an old program supports nothing else.

What is a SOCKS4 proxy?

A SOCKS4 proxy relays TCP connections from your app to IPv4 addresses through its own IP, using the version 4 SOCKS protocol from the early 1990s. It has no password authentication, so SOCKS4 proxies are usually open or limited by an IP allowlist.

How do SOCKS4, SOCKS4a and SOCKS5 differ?

SOCKS4 relays TCP to IPv4 addresses and makes the client resolve host names. SOCKS4a lets the proxy resolve host names. SOCKS5 adds username and password authentication, IPv6 and UDP relaying, and is the only one published as an IETF RFC (RFC 1928).

Are SOCKS4 and SOCKS5 compatible?

Not directly: the first byte of every request is the version number, and a server only answers the versions it implements. Many SOCKS servers accept both, but a client set to SOCKS4 cannot authenticate to a password-protected SOCKS5 proxy, so set the client to SOCKS5.

Does SOCKS4 support authentication?

Not in a useful way. SOCKS4 sends only a user ID string, with no password, which a server may check against an ident service. Proxy services that require a username and password need SOCKS5.

Does SOCKS5 support IPv6 when SOCKS4 does not?

Yes. SOCKS5 has address types for IPv4, IPv6 and domain names, while SOCKS4 has a field for an IPv4 address only. Whether you reach an IPv6 site still depends on the proxy server's own network. ProxyField does not sell IPv6 proxies.

Which SOCKS version do proxy providers offer?

Paid providers almost always offer SOCKS5, because it supports username and password authentication; SOCKS4 shows up mostly in free proxy lists and old software. ProxyField's residential and mobile proxies run over SOCKS5, HTTP and HTTPS, priced per GB.

Should I use socks4:// or socks5h:// in my client?

Use socks5h:// when the proxy supports SOCKS5: it sends host names to the proxy, so DNS lookups happen at the proxy, and it can carry a username and password. Use socks4:// or socks4a:// only for a server that speaks nothing newer.

Easy Trial: 1 GB for $2.95.

Try for the price of 1 GB, no subscription, traffic never expires.