How to Test a Proxy: Speed, Location, Anonymity and Protocol

Bart Proxies Team
9 Min Read

To test a proxy, send a request through it to a service that replies with the IP address it sees, then check four things: the proxy accepts your login, the exit IP (the address websites see) and its location match your order, the response time is acceptable, and the protocol (HTTP or SOCKS5) matches your tool. For a quick proxy test in a browser, paste the proxy into the free Bart Proxies proxy tester. To check leaks, the IP owner and your target site, repeat the test from your own machine with curl.

Quick answer

  • To check if a proxy is working, request https://api.ipify.org through it. If the reply is the proxy's IP address and not your own, the proxy connects and authenticates.

  • For an HTTP proxy, use curl -x http://USERNAME:PASSWORD@HOST:PORT. For SOCKS5, use curl --socks5-hostname HOST:PORT or -x socks5h://.

  • A fair proxy speed test repeats one request several times against one target and compares it with a direct request from the same machine.

  • socks5h:// makes the proxy resolve hostnames. socks5:// resolves them on your machine, so your own DNS resolver sees every lookup.

  • Finish with a WHOIS lookup on the exit IP and one real request to the site you plan to use.

What should a proxy test check?

A complete proxy test has seven checks, run in this order. The first one that fails tells you where to look.

CheckWhat it tells youHow to run it
1. Connect and authenticateThe host, port and login are rightcurl -x to an IP echo URL
2. Exit IP and locationThe address and country a website seesRead the echo reply, then look the IP up
3. Response timeHow much delay the proxy addscurl -w several times, compared with a direct request
4. ProtocolWhether the port speaks HTTP or SOCKS5Try http:// and socks5h:// on the same port
5. LeaksWhether your own IP or DNS lookups are exposedPlain HTTP echo for headers, socks5h for DNS
6. IP owner typeISP network or hosting networkwhois on the exit IP
7. Target siteWhether the site you care about accepts the IPOne normal request to that site

The commands below assume a Bash shell on Linux, macOS or WSL.

What format is your proxy list in?

Most proxy lists come in one of two formats, and many tools accept only one.

  • HOST:PORT:USERNAME:PASSWORD is the colon format that many automation tools import.

  • USERNAME:PASSWORD@HOST:PORT is the URL format. With a scheme in front, such as http:// or socks5h://, it is what curl and most programming libraries expect.

Only the order differs: 203.0.113.10:8080:USERNAME:PASSWORD becomes http://USERNAME:[email protected]:8080. In the URL format, a password that contains @, : or / must be percent-encoded (@ becomes %40), or passed separately with curl's -U option.

With IP whitelisting, the provider allows your own IP address instead of asking for a login, so the line is only HOST:PORT.

How do you check if a proxy is working?

Send a request through the proxy to an IP echo service, a URL that replies with the address it sees. If the reply is the proxy's address, the proxy works.

Test an HTTP proxy with curl

curl -x http://USERNAME:PASSWORD@HOST:PORT https://api.ipify.org

-x (long form --proxy) sets the proxy. Keep the proxy scheme as http:// even when the target is an https:// URL: curl then tunnels through the proxy with the HTTP CONNECT method. -x https:// means a TLS connection to the proxy itself, and it fails unless the proxy offers one.

To keep the login out of the URL, pass it with -U:

curl -x http://HOST:PORT -U USERNAME:PASSWORD https://api.ipify.org

Check a SOCKS proxy with curl

SOCKS5 is a proxy protocol, defined in RFC 1928, that relays TCP and UDP traffic for any application, not only web requests. To check a SOCKS proxy, use either of these equivalent commands.

curl --socks5-hostname HOST:PORT -U USERNAME:PASSWORD https://api.ipify.org
curl -x socks5h://USERNAME:PASSWORD@HOST:PORT https://api.ipify.org

This is also the protocol check. If you do not know which protocol a port speaks, run the HTTP command and the SOCKS5 command against the same HOST:PORT. The one that returns an IP address is the protocol to set in your tool. If both return an IP address, the port accepts both protocols.

Confirm the exit IP and location

The echo reply is the exit IP. It can differ from the HOST you connect to when a provider gives you a gateway address.

Look the exit IP up in an IP geolocation database and compare the country and city with your order. These databases sometimes disagree, so check more than one.

Test proxies online

For a long list, an online proxy tester is faster than typing commands. It connects from its own servers, so the speed it reports is not measured from your machine, and a proxy that only allows your whitelisted IP address will normally fail there.

How do you run a fair proxy speed test?

A fair proxy speed test sends the same request several times to the same target and compares the result with a direct request from the same machine. One request proves little, because network delay varies between requests.

for i in 1 2 3 4 5; do
  curl -x http://USERNAME:PASSWORD@HOST:PORT -s -o /dev/null \
    -w '%{http_code} %{time_starttransfer} %{time_total}\n' \
    https://api.ipify.org
done

-w (long form --write-out) prints timing values in seconds. A status of 000 means curl got no reply from the target. With an https:// target, a rejected proxy login also shows as 000, because the 407 answers the CONNECT request. Run the command with -v to see it. time_starttransfer is the time until the first byte of the reply arrives, and time_total is the whole request. With an HTTP proxy, time_connect only covers the connection to the proxy, so it says nothing about the route to the target.

Then run the same loop without the -x option for a direct baseline. The difference is the delay the proxy adds. Compare the middle value of each set, not the fastest one, and measure from the computer or server that will use the proxy.

The same test in Python

import time
import requests

PROXY = "http://USERNAME:PASSWORD@HOST:PORT"
proxies = {"http": PROXY, "https": PROXY}

for attempt in range(5):
    start = time.perf_counter()
    try:
        r = requests.get("https://api.ipify.org", proxies=proxies, timeout=15)
        print(r.status_code, r.text, round(time.perf_counter() - start, 3))
    except requests.exceptions.RequestException as error:
        print("failed:", type(error).__name__)

For SOCKS5, run pip install "requests[socks]" and set PROXY to socks5h://USERNAME:PASSWORD@HOST:PORT.

How do you check a proxy for leaks?

A proxy leaks when the target can learn your real IP address, or when your own DNS resolver sees the hostnames you visit. This is the anonymity part of the test.

Header leaks

An HTTP proxy can add headers to plain http:// requests. X-Forwarded-For carries the client's original IP address, and Via names the proxy. It cannot add them to https:// requests, which travel inside an encrypted tunnel, and a SOCKS proxy does not change HTTP headers. So test with a plain HTTP URL:

curl -x http://USERNAME:PASSWORD@HOST:PORT http://httpbin.org/ip

The origin field should show one address, the exit IP. Two addresses mean the proxy added X-Forwarded-For, and if one of them is your own IP, the target can see it. To see Via and any other added header, request http://httpbin.org/headers the same way.

DNS leaks

With SOCKS5, the scheme decides who resolves hostnames. socks5:// (curl's --socks5) resolves the name on your machine and sends only the IP address to the proxy. socks5h:// (--socks5-hostname) sends the hostname to the proxy, which resolves it. An HTTP proxy receives the hostname in the request, so the proxy does the lookup.

Is the IP the type you expect, and does it work on your site?

A WHOIS lookup shows who the exit IP is registered to, and a request to your real target shows whether that site accepts it.

ISP or hosting

whois EXIT_IP
whois -h whois.cymru.com " -v EXIT_IP"

The first command returns the registry record: read the organization and network name (OrgName and NetName in ARIN records). The second asks Team Cymru's public lookup service for the ASN (autonomous system number), the ID of the network that announces the IP on the internet.

If you bought ISP proxies, expect the WHOIS record or the ASN to name an internet service provider, not a hosting or cloud company. The two can name different companies, because the holder of a range can let another network announce it. Commercial IP databases also assign their own type label, such as ISP, hosting or mobile, and that label can differ from the WHOIS record.

The site you care about

Finish with one ordinary request to the site you will use, through the proxy, with the same tool you will use later. A 200 status with the expected content passes. A 403 (refused), a 429 (too many requests) or a challenge page means the site is refusing or rate-limiting that request. Keep this test light: a few requests, on pages the site's terms allow you to access.

How do you fix common proxy test errors?

Most failed proxy tests end in one of three errors. Add -v to any curl command to see the proxy's reply.

  • 407 Proxy Authentication Required: an HTTP proxy did not get valid credentials. Check the username and password for typos and stray spaces, and percent-encode special characters. With IP whitelisting, confirm your current public IP is on the list. A SOCKS5 proxy never sends a 407: a bad login fails the SOCKS handshake.

  • Connection refused: nothing accepted the connection on that host and port. Check the port number, and that host and port were not swapped when you converted formats.

  • Timeout: no reply arrived in time. The proxy may be offline, a firewall on your network may block the port, or the target may be slow. Add --connect-timeout 10 --max-time 20 so tests fail fast, and try a second target.

If curl works and your tool does not, the tool is usually set to the wrong protocol or expects the other list format.

Where Bart Proxies fits

Bart Proxies has a free online proxy tester that needs no sign-up. Its page says it accepts host:port, user:pass@host:port or full proxy URLs, one at a time or in bulk, and tests HTTP, HTTPS, SOCKS4 and SOCKS5 proxies with or without authentication. For each proxy it shows the status, the speed, and the exit IP with its country, city and ISP. Tests run server-side, credentials are not stored, and the working proxies can be copied back in their original format.

Bart Proxies sells static ISP proxies, rotating residential proxies and mobile proxies. The ISP plan cards list SOCKS5 and HTTP, and the FAQ says both IP whitelisting and username/password authentication are supported. You can browse proxies by location or proxies by ISP, and see pricing on the home page.

Frequently Asked Questions

Send one request through the proxy to an IP echo service, for example: curl -x http://USERNAME:PASSWORD@HOST:PORT https://api.ipify.org. If the reply is the proxy's IP address and not your own, the proxy connects, accepts your login and forwards traffic.

Run curl --socks5-hostname HOST:PORT -U USERNAME:PASSWORD https://api.ipify.org, or use -x socks5h://USERNAME:PASSWORD@HOST:PORT. Both forms send the hostname to the proxy, so the proxy does the DNS lookup.

Send the same request through the proxy at least five times to the same target and record the time for each one, for example with curl -w and the time_total value. Then run the same request without the proxy from the same machine. The difference is the delay the proxy adds.

It is an HTTP status code sent by a proxy that did not receive valid credentials. Check the username and password, percent-encode special characters in a proxy URL, and if the proxy uses IP whitelisting, confirm that your current public IP address is on the list.

Yes. The Bart Proxies proxy tester at bartproxies.com/proxy-tester is free and needs no sign-up. It tests HTTP, HTTPS, SOCKS4 and SOCKS5 proxies and shows the status, speed, exit IP, country, city and ISP of each one.

Bart Proxies Team
Tags
  • proxy testing
  • curl
  • SOCKS5
  • HTTP proxy
  • troubleshooting