Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Learn how to get the ID of any YouTube video.

How to get the ID of any YouTube Video

This article walks you through how to get the ID of any YouTube video.

How to get a YouTube video ID from a youtube.com page URL

You may be watching the video or just happened to visit a link to a video. The video ID will be located in the URL of the video page, right after the v= URL parameter.

In this case, the URL of the video is: https://www.youtube.com/watch?v=aqz-KE-bpKQ. Therefore, the ID of the video is aqz-KE-bpKQ.

How to get a YouTube video ID from a youtu.be short URL

The youtu.be URLs are created by generating a URL intendend for sharing. They differ slightly from youtube.com URLs because there are no URL parameters. Instead, the video ID is part of the URL itself.

In this case, the URL of the video is: https://youtu.be/aqz-KE-bpKQ. Therefore, the ID of the video is aqz-KE-bpKQ.

How to get a YouTube video ID from an embedded video player

The easiest method is to use the "Stats for nerds" option.

  1. Right click the embedded video player to present a menu.
  2. Select the "Stats for nerds" option in the menu.
  3. Note the "Video ID" property.

Feel free to test on this video player in the following link: http://codepen.io/anon/pen/qReQZL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.