YouTube-dl is a small command-line program you can use to download videos from YouTube as well as other video sites. It is not platform specific, and should work on your Linux, Windows and macOS system. It is released to the public domain, which means you can modify it, redistribute it or use it however you like. This wikiHow article teaches you how to install and use YouTube-dl.

Things You Should Know

  • YouTube-dl is an open-source command-line program that allows you to download videos from YouTube and other video websites.
  • YouTube-dl is completely safe and allows you to download videos without a Premium subscription or having to use sketchy download websites.
  • YouTube-dl is available for Windows, macOS, and Linux.
Method 1
Method 1 of 4:

Using Youtube-dl

  1. 1
    Open the Terminal or Command-Line. If you are using Windows, go ahead and open the Command Prompt. If you are using a Mac open the Terminal in the Utilities folder or using the Spotlight search bar. On Linux, press Ctrl + Alt + T to open the Terminal.
  2. 2
    Change to the directory you want to download videos to. YouTube-dl will download the videos to whichever folder you are in in the Terminal or Command Prompt. To change directories in the Terminal type cd <directory location> and press Enter to change directories.
    • To return to your root directory, type cd\ and press Enter.
    • If the Terminal or Command Prompt is not recognizing YouTube-dl as a command, try navigating to the folder you installed YouTube-dl.
    Advertisement
  3. 3
    Copy the URL to a YouTube video. Go to YouTube in a web browser and play the video you want to copy. Either highlight the URL in the address bar, right-click it and click Copy or open the Share menu and click Copy next to the URL.
  4. 4
    Download a video: Enter the following command in the Terminal or Command Line and press Enter to download the video:
    • Type youtube-dl <url_to_video> and press Enter. To paste the video URL, press Ctrl + V on Windows, Command + V on Mac, or Shift + Ctrl + V on Linux.
    • This will download only the video, without subtitles and description. It automatically chooses the best video and audio quality.
  5. 5
    Download a playlist: You will need to copy the URL to the playlist. Then use one of the following commands to download a playlist:
    • Download a playlist in order: Type youtube-dl <url_to_playlist> and press Enter.
    • Download playlist in reverse order: Type youtube-dl --playlist-reverse <url_to_playlist> and press Enter.
    • Download playlist in random order: Type youtube-dl --playlist-random <url_to_playlist> and press Enter.
    • Download a section of a playlist: Type youtube-dl --playlist-start <number> --playlist-end <number> <url_to_playlist> and press Enter.
  6. 6
    Download a specific video or audio format: Use the following commands to download a video in a specific audio or video format:[1]
    • List available formats: Type youtube-dl --list-format <url_to_video> and press Enter to list all available formats and their format codes.
    • Download a specific format: Type youtube-dl -format <format_code> <url_to_video> and press Enter
    • Merging formats: Sometimes, the best quality is obtained by merging a video format with an audio-only format. Sometimes, there are even only video-only formats and audio-only formats. In that case, you can merge two formats into a single file. To merge two formats, type youtube-dl -f <video format codet>+<audio format code> <format output> <url_to_video> and press Enter.
      • Note that the order is not interchangeable. Specifying the audio first and then the video will result in an error. Format outputs can be "mkv," "mp4," "ogg," "webm," and "flv."
  7. 7
    Download information about a video. This is useful when you only want to get some information, such a list of the subtitles, or the thumbnail picture, but not the video itself. Type youtube-dl --skip-download <url_to_video> and press Enter to download information about the video.
  8. 8
    Download the subtitles. Use the following commands to download subtitles for a video:
    • List all available subtitles: Type youtube-dl --list-subs <url_to_video> and press Enter.
    • Download subtitles: Type youtube-dl --write-sub <url_to_video> and press Enter.
    • Download automatically generated subtitles: Type youtube-dl ---write-auto-sub<url_to_video> and press Enter.
    • Download all subtitles: Type youtube-dl --all-subs <url_to_video> and press Enter.
    • Specify subtitle language:Type youtube-dl --sub-lang <language tag(s)><url_to_video> to specify a subtitle language. You can download more than one language at a time. Separate each language tag with a comma.
  9. 9
    Get additional video information about a video. Use one of the following commands to get additional information about a video:
    • Download video description: Type youtube-dl --write-description <url_to_video> and press Enter.
    • Download video metadata: Type youtube-dl --write-info-json <url_to_video>} and press Enter.
    • Download annotations: Type youtube-dl --write-annotations <url_to_video> and press Enter.
    • Download thumbnail image: Type youtube-dl --write-thumbnail <url_to_video> and press Enter.
  10. 10
    Update Youtube-dl if it suddenly stops working. YouTube regularly changes its way of storing videos, and the old youtube-dl scripts can stop working. If this happens, you may need to update YouTube-dl To do so, type youtube-dl -U and press Enter.
    • Depending on how you installed Youtube-dl, you may need to use sudo youtube-dl -U instead on Linux because you don't have the necessary permissions otherwise.
    • If downloaded YouTube-dl for Windows, or you used a package manager to install YouTube-dl on Mac or Linux, you may need to uninstall and reinstall the latest version of YouTube-dl.
  11. 11
    Download geo-restricted videos. If you want to download a video that is restricted in your country, you can still do so using a proxy server. You can find a list of free proxy servers on the internet. you can find free proxy servers at http://free-proxy.cz/en/. Some may work, and some may not. It may take several tries. Use the following steps to download a geo-restricted video:[2] [3]
    • Type youtube-dl --proxy <proxy IP address>:<port number> <url_to_video>
    • Type youtube-dl --geo-verification-proxy <proxy IP address>:<port number> <url_to_video>
    • Type youtube-dl --geo-bypass <url_to_video>
    • Type youtube-dl --geo-bypass-country <ISO country code> <url_to_video>
  12. Advertisement
Method 2
Method 2 of 4:

Installing YouTube-dl on Windows

  1. 1
    Install Microsoft Visual C++ 2010 Redistributable Package. It is required for the Windows binary to work. You can download it from https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist. Be sure to download the correct version for your PC architecture. Then double-click the installation file in your web browser or Downloads folder. Follow the instructions to complete the download.
    • The oldest version of Windows that supports this package is Windows XP SP3.
  2. 2
    Download the Windows binary of Youtube-dl. Use the following steps to do so:
    • Go to https://youtube-dl.org/ in a web browser.
    • Click on the middle link (that says "youtube-dl.exe") at the top of the page to download the YouTube-dl executable file.
  3. 3
    Create a new folder for the YouTube-dl.exe file. If you want YouTube-dl to be available to all users, you should create a new folder in your "C:/Program Files/" folder. Otherwise, you can create a folder in your "C:" or "D:" drive. You can name the folder "YouTube-dl," "yt-dl" or anything you want. Use the following steps to create a new folder:
    • Press Windows Key + E to open File Explorer.
    • Navigate to where you want to create a new folder for YouTube-dl.
    • Click New in the menu bar at the top.
    • Create a name for the new folder.
  4. 4
    Copy the Youtube-dl.exe file to the new folder. By default, your downloaded files can be found in your Downloads folder. Navigate to your Downloads folder inside File Explorer and right-click the youtube-dl.exe file. Click Copy. Then navigate to the folder you created for YouTube-dl. Right-click inside the folder and click Paste.
  5. 5
    Add Youtube-dl to your PATH. This will let you call it from the command line in any directory. Use the following steps to add YouTube-dl to your PATH environment variables:[4]
    • Right-click the YouTube-dl.exe file.
    • Click Copy as path
    • Click the Windows Start menu.
    • Type path.
    • Click Edit the system environment variables.
    • Click Environment variables.
    • Select Path in the "System variables" window.
    • Click Edit at the bottom.
    • Click New in the menu to the left.
    • Paste the path to the "YouTube-dl" file. DO NOT include the ".exe" at the end of the file.you
    • Click Ok.
  6. 6
    Restart your computer. After adding YouTube-dl to your PATH, go ahead and restart your computer to ensure that YouTube-dl is added to your PATH.
  7. 7
    Install a media player if you haven't yet. Youtube videos are usually stored in the FLV or MP4 formats and you can use a media player such as VLC player to view your videos. You can download the VLC multimedia player from the following link: http://www.videolan.org/vlc/#download.
  8. Advertisement
Method 3
Method 3 of 4:

Installing YouTube-dl on Mac

  1. 1
    Open the Terminal. The Terminal has an icon that resembles a black screen with a white cursor. You can find it in the Utilities folder. Alternatively, you can use the following steps to open the Terminal on Mac:
    • Click the magnifying glass icon in the upper-right corner.
    • Type Terminal in search bar.
    • Click Terminal.app.
  2. 2
    Install Homebrew. Homebrew is an open-source package management system for Mac that allows you to install applications using the Terminal. Use the following Terminal command to download and install Homebrew:[5]
  3. 3
    Install YouTube-dl. To install YouTube-dl, type sudo brew install youtube-dl in the Terminal and press Enter. Again, it may take a while to download and install YouTube-dl.
    • If you would rather install YouTube-dl using MacPorts, type sudo port install youtube-dl in the Terminal and press Enter.
  4. 4
    Install a media player application if you need to. Youtube videos are usually stored in the FLV or MP4 formats and you can use a media player such as VLC player to view your videos. You can download the VLC multimedia player from the following link: http://www.videolan.org/vlc/#download.
  5. Advertisement
Method 4
Method 4 of 4:

Installing on Linux

  1. 1
    Press +Ctrl+Alt+T to open the Terminal. This is the keyboard shortcut to open the Terminal. Alternatively, you can open the Terminal in the Applications menu.
  2. 2
    Consider installing from your package manager. This is the easiest way, but often the Youtube-dl package is outdated and doesn't work. But it may be worth trying before proceeding with the other steps. Use one of the following commands to install YouTube-dl from your package manager:[7]
    • Ubuntu/Debian: sudo apt install youtube-dl.
    • Snap: sudo snap install youtube-dl.
  3. 3
    Download the Linux binary. Enter one of the following commands in the Terminal and press Enter to download the Linux binary.
  4. 4
    Set file permissions for the binary. This makes the YouTube-dl binary executable. If no other user of your device needs it, you can type chmod +x youtube-dl and press Enter to allow yourself to execute the file. If you want let all users of your computer use Youtube-dl, type chmod a+x youtube-dl and press Enter instead.
  5. 5
    Move the file to an appropriate location. Enter the command, sudo mv youtube-dl <directory location> and press Enter to move the YouTube-dl file to your desired location.
    • If you want to install it only for yourself, a good location to move it to is ~/.local/bin/..
    • If you want to install it for all users, a good location is /usr/local/bin/.
    • These directories may or may not already exist, if they don't,you can create them using the command; mkdir directory_name.
  6. 6
    Check if the directory you moved YouTude-dl to is in your PATH. Your PATH is where your environment variables are stored. The directory with YouTube-dl needs to be in your path for you to be able to call upon it at any time in the Terminal. Type echo $PATH and press Enter to see what directories are in your PATH. If it is not in your PATH, use the following command to add it to your PATH:[8]
    • Type export PATH=$PATH:<directory location> and press Enter.
  7. 7
    Re-run the ".profile" script. If the directory you installed Youtube-dl to isn't yet in PATH, running the ".profile" script will add it to your PATH Type: source ~/.profile and press Enter to run the script.
  8. 8
    Install a media player if you haven't yet. YouTube videos are stored different formats, some of the most common are MP4, MKV and WEBM. To view the videos, you need a media player. Some options are MPV or VLC. You can install these through your system's package manager. Use the following steps to download and install VLC:
    • Type sudo apt update and press Enter to update your software repository.
    • Type sudo apt install vlc or sudo apt install mpv, depending on which program you want to install. Then press Enter.
  9. Advertisement

Warnings

  • Downloading monetized videos (videos with ads at the start) will mean that when you watch the video offline, the channel that posted the video will not receive any money. Take this into consideration when downloading videos.
    ⧼thumbs_response⧽
Advertisement

Expert Interview

Thanks for reading our article! If you'd like to learn more about downloading YouTube videos, check out our in-depth interview with Beth Cormack.

About This Article

Beth Cormack
Written by:
Social Media Manager
This article was written by Beth Cormack and by wikiHow staff writer, Travis Boylls. Beth Cormack is a Social Media Manager based in Washington, D.C. With five years of experience, she specializes in multi-channel social media marketing and storytelling. She earned her Master of Professional Studies from Georgetown University School of Continuing Studies and her BA in Communication from the University of Massachusetts-Amherst. This article has been viewed 244,994 times.
How helpful is this?
Co-authors: 30
Updated: March 31, 2023
Views: 244,994
Categories: Media Software
Advertisement