Guide 5 min read Updated

SOCKS5 proxy setup guide

What SOCKS5 does differently from HTTP, why the h in socks5h matters, and copy-ready examples for curl and Python.

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:

  1. Your client connects to the proxy and lists the login methods it supports.
  2. The proxy picks one. With our proxies, that's username and password.
  3. The client sends the username and password, and the proxy accepts or rejects them.
  4. The client asks the proxy to connect to a destination, given as an IP address or a hostname, plus a port.
  5. 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.

Questions, answered

Is a SOCKS5 proxy faster than an HTTP proxy?
Not by itself. SOCKS5 adds very little overhead, but speed mostly depends on the distance to the proxy, the type of IP and the target site. Pick the protocol your software supports best.
Does SOCKS5 encrypt my traffic?
No. SOCKS5 relays traffic but doesn't encrypt it. Use HTTPS or another encrypted protocol to the destination when the content needs protecting.
What is the difference between socks5 and socks5h?
With socks5, your computer resolves the hostname and sends the proxy an IP address. With socks5h, the proxy resolves the hostname, so your local DNS server never sees which site you asked for.
Can I use a SOCKS5 proxy with a password in Chrome?
Not through Chrome's built-in proxy settings, which don't support SOCKS5 username and password authentication. Use the HTTP(S) endpoint in Chrome instead, or a browser tool that handles authenticated SOCKS5 itself.

Real IPs, fresh and clean.

Residential, mobile, ISP and datacenter proxies on one crypto balance. Start with one GB or one IP. No KYC.

  • Real IPs
  • Fresh, clean
  • No KYC
  • Crypto