Proxy Tools · 1 min read

How to check if a proxy is valid (with a ready script)

A proxy is only useful if it is alive, hides your real IP, and is fast enough for the job. This guide covers five ways to test all three — including a ready bash and Python proxy-checker you can run right now.

What a valid proxy actually means

Three separate checks, not one.

People say a proxy is "working" as if it were a single yes-or-no fact. It is not — a proxy can pass one test and fail two others, and each failure ruins a different task. A proper validity check answers three questions.

  • Is it alive? Does a request through it actually complete, or does it hang and time out? Free proxies in particular die constantly — often within hours.
  • Is it anonymous? Does the destination see the proxy's IP, or does the proxy leak your real one through headers? A transparent proxy that forwards your true IP is worse than useless for privacy.
  • Is it fast enough? A live proxy that adds several seconds of latency is fine for a one-off check and hopeless for scraping at scale.

If you just need a quick answer for one proxy, paste it into the s4m proxy checker. If you have a whole list to validate — for example entries filtered from the free public proxy list — use the scripts below to test them in bulk.

Five ways to test a proxy

From a single click to a scripted batch.

Use an online proxy checker

The fastest option: paste HOST:PORT into the /tools/proxy-checker/ tool and read back liveness, response time and anonymity. Ideal for a single proxy or a quick spot check with nothing to install.

Test one proxy with curl

One command reveals whether it is alive and what exit IP the world sees: curl through the proxy to an IP-echo endpoint and compare the result with your real IP. If they match, the proxy is transparent and leaking you.

Check the anonymity level

Request an endpoint that reflects your headers. A high-anonymity (elite) proxy sends no Via or X-Forwarded-For revealing your origin; an anonymous one hides your IP but announces it is a proxy; a transparent one forwards your real IP. This maps to the elite/anonymous/transparent filters on the free list.

Measure the latency

Liveness is not enough for bulk work. Time the request (the scripts below print milliseconds) and drop anything too slow for your task. See the companion guide on measuring proxy latency honestly.

Automate the whole list with a script

For dozens or thousands of proxies, loop through a file and record alive/dead, exit IP and latency. The bash and Python checkers below do exactly this — copy, save, and run.

Bash proxy checker

Save as proxy-check.sh, put one HOST:PORT per line in proxies.txt (SOCKS5 assumed), then: bash proxy-check.sh proxies.txt

bash
#!/usr/bin/env bash
# proxy-check.sh — test proxies for liveness, latency and anonymity.
# Usage: bash proxy-check.sh proxies.txt   (one HOST:PORT per line, SOCKS5)
set -u
TARGET="https://api.ipify.org"
TIMEOUT=8

myip=$(curl -s --max-time "$TIMEOUT" "$TARGET")
echo "your real IP: $myip"
echo "-------------------------------------------"

while IFS= read -r proxy; do
  [ -z "$proxy" ] && continue
  start=$(date +%s.%N)
  out=$(curl -s --max-time "$TIMEOUT" --socks5-hostname "$proxy" "$TARGET")
  code=$?
  end=$(date +%s.%N)
  if [ $code -ne 0 ] || [ -z "$out" ]; then
    printf '%-22s DEAD\n' "$proxy"
    continue
  fi
  ms=$(awk "BEGIN{printf \"%d\", ($end-$start)*1000}")
  if [ "$out" = "$myip" ]; then
    printf '%-22s ALIVE %5sms  TRANSPARENT (leaks your IP!)\n' "$proxy" "$ms"
  else
    printf '%-22s ALIVE %5sms  OK exit=%s\n' "$proxy" "$ms" "$out"
  fi
done < "$1"

Python proxy checker

Save as proxy_check.py and run: pip install "requests[socks]" && python3 proxy_check.py proxies.txt

python
#!/usr/bin/env python3
"""proxy_check.py — validate proxies for liveness, latency and anonymity.
Usage: python3 proxy_check.py proxies.txt   (one HOST:PORT per line)
Requires: pip install "requests[socks]"
"""
import sys, time, requests

TARGET = "https://api.ipify.org"
TIMEOUT = 8

def real_ip():
    return requests.get(TARGET, timeout=TIMEOUT).text.strip()

def check(proxy, my_ip):
    proxies = {"http": f"socks5h://{proxy}", "https": f"socks5h://{proxy}"}
    t0 = time.perf_counter()
    try:
        exit_ip = requests.get(TARGET, proxies=proxies, timeout=TIMEOUT).text.strip()
    except Exception:
        return f"{proxy:22} DEAD"
    ms = int((time.perf_counter() - t0) * 1000)
    if exit_ip == my_ip:
        return f"{proxy:22} ALIVE {ms:5}ms  TRANSPARENT (leaks your IP!)"
    return f"{proxy:22} ALIVE {ms:5}ms  OK exit={exit_ip}"

def main():
    my_ip = real_ip()
    print("your real IP:", my_ip)
    print("-" * 43)
    with open(sys.argv[1]) as fh:
        for line in fh:
            p = line.strip()
            if p:
                print(check(p, my_ip))

if __name__ == "__main__":
    main()

Reading the results

What DEAD, TRANSPARENT and OK tell you.

Both scripts print the same three verdicts. DEAD means the request never completed — the proxy is down, blocked, or too slow past the timeout; discard it. TRANSPARENT means the proxy answered but the exit IP equals your real IP, so it is forwarding your true address and gives you no anonymity at all. OK with a different exit IP and an acceptable millisecond figure is what you keep.

Repeat checks with timeouts and retries. Our free proxy list shows recorded check results. The catalogue retains historical records, including entries marked as not working. A recorded success does not guarantee a connection now. Review the status and timestamp, then validate an endpoint before use. Related services: s4m datacenter proxies. Authentication or payment does not guarantee availability or acceptance by a destination. Related topics: how we measure latency.

FAQ

Questions, answered

How do I know if a proxy is leaking my real IP?

Send a request through the proxy to an IP-echo service and compare the returned address with your real IP. If they are the same, the proxy is transparent and forwarding your true address — the scripts above flag this as TRANSPARENT. A proper proxy returns a different exit IP.

What is the difference between elite, anonymous and transparent proxies?

An elite (high-anonymity) proxy hides your IP and does not reveal that a proxy is in use. An anonymous proxy hides your IP but signals it is a proxy via headers. A transparent proxy forwards your real IP entirely. The free list lets you filter by exactly these levels.

Why do proxies from a free list die so quickly?

Most are hosts left open by accident; when the owner reboots, patches or notices the traffic, they vanish — often within hours. That is why you must re-check lists continuously rather than trust a one-time snapshot, and why paid datacenter proxies exist for work that must not fail.

Can I use the script for HTTP proxies too?

Yes. The examples assume SOCKS5 (socks5h), which also resolves DNS remotely. For an HTTP proxy, change the scheme to http:// (curl -x http://HOST:PORT, or http:// in the Python proxies dict) and point it at the proxy's HTTP port, such as 3128.

Stop babysitting dead proxies

Use timeouts, retries and health checks. Authentication or payment does not guarantee availability or acceptance by a destination. Review the status and timestamp, then validate an endpoint before use.

People found this page by searching for

Real search phrases this page answers — the linked ones open the page that covers them in depth.