yt-dlp Cheat Sheet
The yt-dlp commands I actually use: install and update, format selection, audio, subtitles, playlists, cookies, rate limiting, output templates, and post-processing. ffmpeg is required for merging and audio extraction.
yt-dlp is the free, open-source command-line YouTube downloader I reach for whenever I need video, audio, or subtitles off the command line. It is the maintained community fork of youtube-dl, costs nothing, ships no ads or watermarks, and runs entirely on your own machine. This page is the reference I keep open: every flag worth knowing, grouped by what you are actually trying to do. Build a command first, then scroll for the detail.
Paste a YouTube URL, choose what to grab, and copy the command. It updates as you change the options.
Resolution is a maximum, not a guarantee. yt-dlp grabs the best quality at or below your pick, capped by what was actually uploaded. Choose 8K on a 720p video and you get 720p, not an error and not an upscale.
yt-dlp --merge-output-format mp4 "https://www.youtube.com/watch?v=dQw4w9WgXcQ"Paste this into your terminal AI and it runs the command for you, installing the tool first if you do not have it. Works with Claude Code, OpenAI Codex CLI, Gemini CLI, GitHub Copilot CLI, Aider, Cursor Agent, Warp, OpenCode, Cline and any other CLI coding agent.
Goal: download the video from this YouTube link.
Run this command in my shell:
yt-dlp --merge-output-format mp4 "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
First check whether `yt-dlp` is installed (run `command -v yt-dlp`). If it is not, install it with my system's package manager before running anything: macOS `brew install yt-dlp ffmpeg`, Debian/Ubuntu `sudo apt install yt-dlp ffmpeg`, Fedora `sudo dnf install yt-dlp ffmpeg`, Windows `winget install yt-dlp ffmpeg`. Then run the command above.
Show me any command that needs sudo before you run it, tell me where the output file landed when you are done, and do not run anything else.You run this at your own risk. An AI agent can execute commands on your machine; review what it does before approving. TechEarl is not liable for the outcome, see the Terms of Service.
If you searched for youtube-dl, a free YouTube downloader, or a youtube downloader command line tool, this is the page. youtube-dl (originally written by Ricardo García, "rg3") still exists, but it is no longer actively maintained and routinely breaks when YouTube changes its player. yt-dlp is the actively maintained successor: a faster release cadence, far more extractors, and the same command syntax, so every youtube-dl command runs as yt-dlp with better results. When people say "YT download" tool in 2026, this is almost always what they mean.
Download only what you have the right to. Saving your own uploads, Creative Commons material, or content the rights holder permits is one thing; redistributing copyrighted video, or bulk-downloading in a way that violates YouTube's (or any site's) Terms of Service, is another. This reference is for the legitimate cases. What you do with the file is on you.
A note that runs through the whole sheet: install ffmpeg. yt-dlp needs it to merge the separate video and audio streams modern YouTube serves, and to extract or convert audio. The single most common "it only gave me 720p" or "audio extraction failed" complaint is a missing ffmpeg.
The cheat sheet
Everything below is grouped the way I think about a download: get it installed, grab something, then refine quality, audio, subtitles, scale to playlists, and clean up the output.
Install and keep it current
Pick the line for your platform from the install block above. The non-negotiable extra is ffmpeg: Homebrew (brew install yt-dlp ffmpeg) bundles it in one command; on Linux install it with apt/dnf/pacman; on Windows run winget install Gyan.FFmpeg alongside yt-dlp.
Keeping yt-dlp current is not optional with this tool. YouTube changes its player often enough that a stale build simply stops working, and updating is the first thing to try when a download breaks. The standalone binary self-updates with yt-dlp -U; a pipx install updates with pipx upgrade yt-dlp; Homebrew uses brew upgrade yt-dlp. Distro packages (the apt one in particular) lag badly, which is why I prefer pipx for a cross-platform install.
Picking the quality
Run yt-dlp -F "URL" to see what a video actually offers: a table of format IDs, resolutions, codecs, and sizes. Then select with -f. The selector I use almost always is bv*[height<=1080]+ba/b, which reads as "best video at or below 1080p, plus best audio, or fall back to the best single file." Change 1080 to whatever ceiling you want; the [height<=N] filter is a ceiling, not a request, so you only get 4K if the creator uploaded 4K.
The trap to avoid is -f best. On modern YouTube the high resolutions are served as separate video-only and audio-only streams, and best only matches a single already-combined (muxed) file, which YouTube caps at around 720p. So -f best quietly hands you 720p and people conclude yt-dlp "can't do 1080p." The bv*+ba selector plus ffmpeg is the fix. For the full walkthrough, including Shorts and the bot check, see how to download a YouTube video in any quality.
Audio only
-x (extract audio) strips the sound without downloading and re-muxing the video by hand. My default is yt-dlp -x --audio-format m4a --audio-quality 0 "URL": M4A is the AAC track YouTube already serves, so there is no quality-losing re-encode. Opus (--audio-format opus) is the other native codec and an excellent choice; MP3 (--audio-format mp3) re-encodes and exists only for ancient players. Add --embed-thumbnail --embed-metadata to bake cover art and tags into the file. The complete flow with chapter splitting is in download YouTube audio to MP3, M4A, or Opus.
Subtitles and transcripts
yt-dlp --list-subs "URL" shows which languages a video has, including auto-generated captions. To pull the text without the video, combine --skip-download with --write-subs --write-auto-subs --sub-langs en --convert-subs srt. That writes an SRT file (or VTT if you skip the conversion) and nothing else, which is exactly what you want when feeding a summarizer or taking notes. For converting captions to clean plain text, see extract a YouTube video's transcript or captions.
Playlists, channels, and archives
Point yt-dlp at a playlist URL or a channel @handle URL and it downloads the lot. Two flags make bulk jobs sane. --download-archive archive.txt records every video ID it finishes, so re-running the same command skips what you already have, which turns a one-shot grab into something you can run weekly. --playlist-items 1-10 (or a comma list) limits the range. An output template like -o "%(playlist_index)s - %(title)s.%(ext)s" numbers the files so they sort in playlist order. The full resumable channel workflow, with rate limiting, is in download a YouTube playlist or channel.
Cookies, auth, and the Chrome gotcha
When YouTube interrupts a download with "Sign in to confirm you're not a bot," or when a video is members-only, age-restricted, or region-locked and you have legitimate access, hand yt-dlp your browser cookies:
yt-dlp --cookies-from-browser firefox "URL"Use Firefox, not Chrome. Since around July 2024, Chrome encrypts its cookie store with app-bound encryption, and external tools (yt-dlp included) can no longer read Chrome cookies on a running profile. Firefox's cookie store is still readable, so --cookies-from-browser firefox is the one that reliably works in 2026. The alternative is exporting a Netscape-format cookies.txt with a browser extension and passing --cookies cookies.txt.
Being polite to the server
For anything beyond a single video, throttle yourself. --sleep-requests 1 puts a second between requests; -r 3M (or its long form --limit-rate 2M) caps the download rate. This is partly courtesy and partly self-preservation: hammering a site is the fastest way to trip its bot detection and get your IP rate-limited. The same etiquette applies to every extractor, including TikTok video downloads and Facebook video downloads.
Output templates
By default yt-dlp bakes the video ID into the filename. An output template (-o) fixes that. -o "%(title)s.%(ext)s" gives a readable name; -o "%(uploader)s/%(upload_date)s - %(title)s.%(ext)s" builds a per-uploader folder tree dated by upload. There are dozens of fields (uploader, resolution, id, playlist_index); the percent-paren-s syntax is the standard output-template form documented in the yt-dlp README.
Post-processing
The post-processors run after the download finishes. --embed-subs (with --write-subs) and --embed-chapters fold subtitles and chapter markers into the file. --remux-video mp4 repackages into MP4 without re-encoding when the codecs are already compatible, which is fast and lossless. --sponsorblock-mark all uses the community SponsorBlock database to mark sponsor, intro, and outro segments as chapters; swap mark for remove to physically cut them out. These compose with everything above, so a single command can download at 1080p, embed subtitles, and strip sponsor segments in one pass.
FAQ
Yes. yt-dlp is free and open source (released into the public domain under the Unlicense), with no ads, no paywall, no watermark, and no download limits. Unlike the "free YouTube downloader" websites that wrap a tool like this in ads and trackers, yt-dlp runs entirely on your own machine and costs nothing.
yt-dlp. It is the maintained fork of youtube-dl (originally written by Ricardo García, "rg3"), ships far more frequently, has many more extractors, and keeps working when YouTube changes its player. youtube-dl is no longer actively maintained and breaks often. yt-dlp accepts the same command syntax, so anything written for youtube-dl runs as yt-dlp.
For best results, yes. The high-resolution video and audio arrive as separate streams and ffmpeg merges them into one file. Audio extraction (-x) and format conversion will not work at all without it. Install it alongside yt-dlp: brew install yt-dlp ffmpeg on macOS, winget install Gyan.FFmpeg on Windows, or your distro's package on Linux.
Since around July 2024, Chrome encrypts its cookie store with app-bound encryption, and external tools (yt-dlp included) can no longer read Chrome cookies while the browser is running. The fix is to use Firefox instead: yt-dlp --cookies-from-browser firefox URL. Firefox's cookie store is still readable, so it works reliably in 2026. Alternatively, export a Netscape-format cookies.txt with a browser extension and pass --cookies cookies.txt.
You are almost certainly using -f best, which only matches a single combined stream, and YouTube caps those at ~720p. Use a bestvideo+bestaudio selector such as -f "bv*[height<=1080]+ba/b" and make sure ffmpeg is installed so yt-dlp can merge the higher-resolution video and audio into one file.
Yes. yt-dlp ships thousands of extractors. The same tool and most of these flags work on TikTok, Instagram, Facebook, and many more. See download a TikTok video, download an Instagram Reel, and download a Facebook video for the per-site notes (mainly which cookies each one needs).
See also
- How to download a YouTube video (any quality): the full walkthrough with resolution selection, Shorts, and the bot check.
- Download YouTube audio: extract audio directly to M4A, Opus, or MP3 with
-x --audio-format. - Download a YouTube playlist or channel: the bulk workflow with
--download-archiveand output templates. - Extract a YouTube video's transcript or captions: pull the subtitles as plain text, no video.
- Download a TikTok video: the same tool, with TikTok's cookie note.
- Download a TikTok profile: grab every video from one account with an archive file.
- Download an Instagram Reel: pull a Reel (and what Instagram needs for cookies).
- Download a Facebook video: save a public Facebook video from the command line.
Sources
Authoritative references this article was fact-checked against.
- yt-dlp README (official)github.com
- yt-dlp format selection (official docs)github.com
- yt-dlp output template (official docs)github.com
- yt-dlp FAQ (official wiki)github.com





