yt-dlp Proxy: How to Use --proxy with HTTP, SOCKS5 and Residential Proxies (2026)

How to use a proxy with yt-dlp: --proxy syntax for HTTP and SOCKS5, logins, config files and environment variables, which proxies YouTube blocks, rotating proxies without 403s, region-locked videos, and every proxy error with its fix.

Vid Kraken · Updated October 28, 2026

You usually need a proxy with yt-dlp for one of three reasons: YouTube blocks your server's IP, you're downloading in bulk and getting rate-limited, or a video is blocked in your country.

Short version: add --proxy "http://user:pass@host:port" (or socks5://...) to your command. On YouTube, datacenter proxies are usually blocked just like your server is, so use residential proxies. If you rotate them, keep one IP per video. A proxy in an allowed country is also the only way yt-dlp can get a region-locked YouTube video; --xff doesn't work for YouTube.

The --proxy syntax

yt-dlp --proxy "http://203.0.113.10:8080" "https://www.youtube.com/watch?v=VIDEO_ID"
  • Schemes: http, https, socks4, socks4a, socks5 and socks5h. An https:// proxy needs the requests package, which pip install "yt-dlp[default]" and the official executables include.
  • socks5 or socks5h: with socks5h, the proxy also looks up domain names. Use it when DNS from your machine is blocked, or when you don't want your own DNS server to see what you download.
  • Special characters in the password: if it contains #, /, ? or %, URL-encode them (# becomes %23), or yt-dlp will read the URL wrongly.
  • Everything goes through it: the YouTube page, the API calls and the video file itself. If your proxy bills per GB, every download counts against it.

Set it once

Rather than adding --proxy to every command, put it in yt-dlp's config file:

mkdir -p ~/.config/yt-dlp
echo '--proxy http://user:[email protected]:8080' >> ~/.config/yt-dlp/config

Two other ways:

  • Environment variables. If you don't pass --proxy, yt-dlp uses HTTPS_PROXY and HTTP_PROXY, like most command-line tools. If only HTTP_PROXY is set, it's used for HTTPS as well. --proxy "" ignores them.
  • Python. In the yt-dlp Python API, pass "proxy": "http://user:[email protected]:8080" in the options dictionary.

Which proxies work with YouTube

The proxy only helps if YouTube trusts its IP more than yours.

Proxy typeOn YouTube
Datacenter proxies and most VPNsOften blocked, the same way your cloud server is: "Sign in to confirm you're not a bot" or 403 errors
Residential proxiesWork most often. Usually billed per GB of traffic
Mobile proxiesAlso work well, at a higher price
TorMost exit nodes are flagged, so expect bot checks and slow downloads
Free proxy listsAvoid. Slow, often already flagged, and the operator can see and change your traffic

What about a VPN?

yt-dlp needs no flag to use a VPN. A VPN routes all of the machine's traffic, so yt-dlp goes through it automatically. The catch is the IP: VPN servers sit in datacenters and are shared by many users, so YouTube often gives them the same bot checks as a cloud server. If you want only yt-dlp's traffic to go through the VPN, check whether your provider offers a SOCKS5 or HTTP proxy address, and pass that to --proxy.

Test a proxy before you rely on it. If yt-dlp --proxy "..." --simulate "URL" gets a bot check on a public video that works from home, the proxy's IP is flagged.

Rotating proxies without 403s

yt-dlp uses one proxy for the whole command. It doesn't rotate by itself. There are two common setups:

  • A list of proxies: pick a different one for each video.
  • A rotating gateway: one address, and the provider changes the IP behind it.

With either, keep the same IP for the whole video. YouTube's stream URLs are tied to the IP that requested them. If a rotating gateway switches IP between the page request and the download, or during the download, you get a 403 partway through. Most providers offer "sticky" sessions that hold one IP for a few minutes; use those, and rotate between videos rather than within one.

while read -r url; do
  proxy=$(shuf -n 1 proxies.txt)
  yt-dlp --proxy "$proxy" --sleep-requests 1 "$url"
done < urls.txt

Rotation spreads your requests across IPs, but it doesn't make bulk downloading invisible. Keep pauses between requests (--sleep-requests, --sleep-interval), especially if you see HTTP Error 429.

Region-locked videos

YouTube decides what's blocked from the IP it sees, so you need a proxy in a country where the video is allowed. Two options look like they'd help but don't do anything on YouTube:

  • --xff and --geo-bypass fake an X-Forwarded-For header. They help on some sites, but yt-dlp turns them off for YouTube, where a faked header doesn't help.
  • --geo-verification-proxy is used by some other sites to check your location. yt-dlp's YouTube extractor never uses it; YouTube downloads go through --proxy.

To find a country to use, Vid Kraken's metadata endpoint returns a video's regionRestriction: the countries it's allowed or blocked in.

Proxy errors and how to fix them

Error containsCauseFix
Unable to connect to proxy … Connection refusedWrong host or port, or the proxy is downCheck the address. Try it with curl -x
Tunnel connection failed: 407 Proxy Authentication RequiredWrong username or password, or your IP isn't on the provider's allowlistCheck the login, URL-encode special characters, or allowlist your server's IP
SocksHTTPSConnection … Failed to establish a new connectionThe SOCKS proxy is unreachableCheck the address and port, and that the scheme is socks5/socks5h, not http
Read timed outA slow or overloaded proxyRaise --socket-timeout (for example 30), or use another proxy
A bot check, but only through the proxyThe proxy's IP is flaggedUse a residential proxy or another exit IP
403 partway through a downloadThe IP changed mid-videoUse a sticky session
The uploader has not made this video available in your countryThe proxy is in a blocked countryUse a proxy in an allowed country

For anything else, run the command with -v and see yt-dlp not working.

When proxies stop being worth it

For a handful of downloads, one decent residential proxy is enough. At scale, the proxies become the work: paying per GB for every download (including the failed ones), finding IPs YouTube hasn't flagged yet, sticky sessions, retries, and countries for region-locked videos. All of it changes whenever YouTube does.

If downloads are a feature of your product, a managed API takes that off your hands. With Vid Kraken, you send a YouTube URL and get a direct link to the file on our CDN. Bot detection, proxies and YouTube's changes are handled on our side. When a video can't be downloaded, you get a typed error code such as GEO_RESTRICTED, and failed downloads aren't charged. See the YouTube downloader API guide.

Check a video without a proxy

Paste a YouTube URL. If you get a file, the video is fine and the block is on your side.

Paste a link. See it work.

Paste a YouTube link, pick a format, and hit download.

No proxies to buy, rotate or debug.

Send a YouTube URL, get a direct MP4 or MP3 link. You pay for bandwidth only, and failed downloads are free.

Start free

Frequently asked questions

How do I use a proxy with yt-dlp?+

Add --proxy with the proxy's URL: yt-dlp --proxy "http://user:password@host:port" "VIDEO_URL". For SOCKS5, use socks5:// or socks5h://. To use it every time, put the --proxy line in ~/.config/yt-dlp/config (Linux and macOS) or %APPDATA%\yt-dlp\config.txt (Windows).

Does yt-dlp support SOCKS5 proxies?+

Yes. Use socks5://host:port, or socks5h://host:port to resolve domain names through the proxy too. socks4 and socks4a work as well. Add user:password@ before the host if the proxy needs a login.

What kind of proxy works best for YouTube with yt-dlp?+

Residential or mobile proxies. YouTube often blocks datacenter proxies and VPNs the same way it blocks cloud servers, and most Tor exit nodes are flagged.

Can I use a VPN with yt-dlp?+

Yes. A VPN routes all traffic on your machine, so yt-dlp uses it without any extra flag. VPN IPs are shared datacenter IPs, though, and YouTube often treats them like cloud servers, with bot checks or 403s. To send only yt-dlp through the VPN, use your provider's SOCKS5 or HTTP proxy address with --proxy, if it has one.

Why do I get 403 errors with a rotating proxy?+

YouTube's stream URLs are tied to the IP that requested them. If the proxy switches IP between loading the video page and downloading the file, the download gets 403. Use a sticky session so one video keeps one IP, and rotate between videos.

Can yt-dlp bypass YouTube region restrictions?+

Only with a proxy in a country where the video is allowed. --xff and --geo-bypass don't work on YouTube, and --geo-verification-proxy isn't used for YouTube.

Does yt-dlp use the HTTP_PROXY environment variable?+

Yes. Without --proxy, yt-dlp uses HTTPS_PROXY and HTTP_PROXY. If only HTTP_PROXY is set, it's used for HTTPS too. Pass --proxy "" to connect directly and ignore them.