Back to terminal directory

CLI tools · Media

yt-dlp

Downloads video and audio from thousands of sites. Needs a JavaScript runtime such as Deno for full YouTube support.

Open sourcePython
Official site
Short answer

yt-dlp is a free, open-source command-line program for downloading video and audio from YouTube and more than a thousand other sites. It is the community-maintained fork of youtube-dl and is released into the public domain under the Unlicense. Since November 2025, full YouTube support needs an external JavaScript runtime: Deno 2.3 or later is the recommended choice, with Node 22 or later also supported. yt-dlp needs Python 3.10 or later and works best with ffmpeg installed for merging and converting. Install it with pip install -U "yt-dlp[default]", brew install yt-dlp or the standalone binary, then run yt-dlp followed by a URL.

License
Unlicense (public domain)
GitHub, yt-dlp/yt-dlp
Minimum Python
3.10, since release 2025.10.22
yt-dlp releases
JavaScript runtime for YouTube
Required since 2025.11.12. Deno 2.3+ or Node 22+
yt-dlp wiki, EJS
Security release
2026.06.09, fixing three CVEs
yt-dlp releases

Updated October 21, 2026How we evaluate tools

yt-dlp guide: install, JavaScript runtime, formats, audio, subtitles and safe use

yt-dlp began in 2020 as a fork of youtube-dl, which had slowed down, and it is now the version most people mean when they talk about downloading video from the command line. It supports more than a thousand sites, fixes breakages quickly, and adds features youtube-dl never had, such as SponsorBlock integration, better format sorting and browser cookie import. Many graphical download apps and media servers use it underneath.

The last year brought two changes that break old setups. In October 2025, version 2025.10.22 dropped Python 3.9. In November 2025, version 2025.11.12 made an external JavaScript runtime necessary for full YouTube support. If yt-dlp suddenly shows far fewer formats or fails on YouTube, a missing runtime is the most likely cause.

Installing yt-dlp

MethodCommandNotes
pippip install -U "yt-dlp[default]"Includes yt-dlp-ejs
pipxpipx install "yt-dlp[default]"Keeps it isolated
Homebrewbrew install yt-dlp
Windowswinget install yt-dlp.yt-dlp
Standalone binaryDownload from GitHub releasesBundles Python and yt-dlp-ejs

Also install:

  • ffmpeg, for merging separate video and audio streams and converting formats. brew install ffmpeg, winget install ffmpeg or your Linux package manager.
  • A JavaScript runtime for YouTube. Deno is the default: brew install deno or curl -fsSL https://deno.land/install.sh | sh. Node 22 or later also works.

The JavaScript runtime requirement

YouTube now protects its video URLs with JavaScript challenges. yt-dlp handles them with yt-dlp-ejs, a set of scripts it runs in an external runtime. The supported runtimes since release 2026.06.09:

RuntimeMinimum versionStatus
Deno2.3Default and recommended
Node22Supported, use --js-runtimes node
QuickJS2023-12-9 (2025-4-26 or later for speed)Use --js-runtimes quickjs
QuickJS-ngAny (0.12.0 or later for speed)Use --js-runtimes quickjs
Bun1.2.11 to 1.3.14 onlyDeprecated, use --js-runtimes bun

Only Deno is turned on by default. Add the --js-runtimes line for any other runtime to your config file so you do not need to pass it every time. Deno also runs the scripts with restricted permissions, with no file system or network access, which Bun does not offer.

Since 2026.01.29, yt-dlp can also use Deno installed as a Python package, which helps where you cannot install system software. If you installed yt-dlp with pip without the [default] extra, add the scripts with pip install -U yt-dlp-ejs.

Basic downloads

yt-dlp "https://www.youtube.com/watch?v=VIDEO_ID"

Put URLs in quotes so your shell does not treat & or ? as special. By default yt-dlp picks the best video and audio and merges them into one file named after the video title.

TaskCommand
List formatsyt-dlp -F URL
Best up to 1080pyt-dlp -f "bv*[height<=1080]+ba/b" URL
Prefer MP4 at 720pyt-dlp -S res:720,ext:mp4 URL
Audio only, MP3yt-dlp -x --audio-format mp3 URL
Original audioyt-dlp -f bestaudio URL
Name filesyt-dlp -o "%(upload_date)s %(title)s.%(ext)s" URL

Playlists and channels

A playlist or channel URL downloads every video. Useful options:

  • -I 1:10 downloads only items 1 to 10.
  • --download-archive done.txt records finished videos and skips them next time, which makes channel updates incremental.
  • -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" keeps files in order inside a folder.
  • --dateafter 20260101 limits by upload date.

Subtitles, metadata and SponsorBlock

OptionEffect
--write-subs --sub-langs enDownload English subtitles
--write-auto-subsInclude auto-generated subtitles
--embed-subsPut subtitles inside the video file
--embed-metadataAdd title, artist and date tags
--embed-thumbnailAdd cover art
--sponsorblock-remove sponsorCut sponsor segments using SponsorBlock data
--embed-chaptersKeep chapter markers

Subtitle files are handy for AI work: yt-dlp --skip-download --write-auto-subs --sub-langs en URL saves only the transcript, which you can summarize or search without downloading the video.

Config files

Options you always use can go in a config file, one option per line:

# ~/.config/yt-dlp/config
-o ~/Videos/%(title)s.%(ext)s
--embed-metadata
--embed-subs
--sub-langs en

yt-dlp also reads a yt-dlp.conf in the current folder. Use --ignore-config to skip config for one run.

Cookies and sign-in

Some videos need you to be signed in, such as age-restricted or members-only content. --cookies-from-browser firefox reads cookies from your browser, and --cookies cookies.txt uses an exported cookie file. Only use your own account. Cookie files hold your session, so keep them private and do not paste them into chats with AI assistants or bug reports.

Security changes in 2026

Release 2026.06.09 fixed three security issues:

  • CVE-2026-50019. Cookies could leak to the wrong site when downloading through curl.
  • CVE-2026-50023. Downloads with dangerous file extensions are now blocked.
  • CVE-2026-50574. Code execution through crafted manifests when using aria2c. yt-dlp removed HLS and DASH support through aria2c. Use the built-in downloader with -N 4 for parallel fragments instead.

The same release restricted --exec to safe conversions. Use the %(...)q form, which quotes values for the shell, when passing fields such as the title to a command. If you have scripts that use --exec or --downloader aria2c, test them after updating. --compat-options 2025, added in 2026.01.29, restores some older behaviors during migration.

Updating

Sites change often, and an out-of-date yt-dlp is the usual reason downloads fail.

InstallUpdate
Standalone binaryyt-dlp -U
pippip install -U "yt-dlp[default]"
Homebrewbrew upgrade yt-dlp
Nightly channelyt-dlp --update-to nightly

Update yt-dlp-ejs and your JavaScript runtime at the same time.

yt-dlp is a general tool, and its legality depends on what you download. Downloading your own content, Creative Commons or public-domain videos, or material for uses your local law allows is generally fine. Downloading copyrighted videos without permission can infringe copyright, and most video sites forbid downloading in their terms of service. Do not use yt-dlp to bypass paywalls or redistribute others' work. When collecting video for AI training or research datasets, check licenses and get legal advice for anything beyond personal use.

Limits

Breaks when sites change. Expect to update often, and use nightly builds when the stable release is behind.

Rate limiting. Large playlists can trigger throttling or temporary blocks. --sleep-interval 5 and --limit-rate reduce this.

More dependencies than before. Python, ffmpeg and a JavaScript runtime all need to stay current for YouTube.

yt-dlp compared with other tools

ToolTypeSitesNotes
yt-dlpCommand line1,000+Most active, most options
youtube-dlCommand lineManyOriginal project, far fewer updates
gallery-dlCommand lineImage and gallery sitesComplements yt-dlp
Desktop front endsGUIVariesMany wrap yt-dlp

Choose yt-dlp for downloading or archiving media you have the right to keep, and for pulling transcripts into AI tools. See the terminal tools guide for more command-line tools.

Frequently asked questions

Why does yt-dlp say it needs a JavaScript runtime?

YouTube's player now relies on JavaScript challenges that yt-dlp's built-in Python interpreter could no longer solve reliably. Since release 2025.11.12, yt-dlp runs that code in an external runtime through its yt-dlp-ejs component. Install Deno 2.3 or later, which yt-dlp uses by default, or Node 22 or later. Without one, many YouTube formats are missing or downloads fail. Installing with pip install -U "yt-dlp[default]" also pulls in yt-dlp-ejs.

How do I download only the audio?

Run yt-dlp -x --audio-format mp3 followed by the URL. -x extracts audio, and --audio-format converts it, which needs ffmpeg. To keep the original audio without converting, which is better quality, leave out --audio-format or use -f bestaudio. Add --embed-thumbnail and --embed-metadata to include cover art and tags.

How do I choose video quality?

yt-dlp downloads the best video and audio and merges them by default. Use -F to list formats, then -f with a format code, or a selector such as -f "bv*[height<=1080]+ba/b" for the best video up to 1080p plus the best audio. -S sorts formats, for example -S res:720,ext:mp4 to prefer 720p MP4. Merging separate streams needs ffmpeg.

How do I update yt-dlp?

Sites change often, so update regularly. Run yt-dlp -U for the standalone binary, pip install -U "yt-dlp[default]" for a pip install, or brew upgrade yt-dlp for Homebrew. If YouTube downloads break, update yt-dlp, yt-dlp-ejs and your JavaScript runtime before reporting a bug. The nightly channel, yt-dlp --update-to nightly, often has fixes first.

Is it legal to use yt-dlp?

The tool itself is legal in most countries and has many lawful uses, such as downloading your own uploads, Creative Commons videos, public-domain material and content for research or accessibility where the law allows. Downloading copyrighted material without permission can breach copyright law and usually breaches the site's terms of service. Check the law where you live and the terms of the site before downloading.

Sources

  1. yt-dlp on GitHub
  2. yt-dlp releases
  3. yt-dlp wiki, EJS (JavaScript runtime)
  4. yt-dlp installation wiki
  5. Deno