YouTube Image Thumbnail URLs

I’ve always known there were a few different URLs to jpeg images of your YouTube videos, but I’ve just realized there are a few more URLS for YouTube thumbnail images than I previously thought and thus wanted to document the options.  To the best of my knowledge YouTube doesn’t post these image URLs all for developers to use YouTube thumbnails. So here is the list I have come up with.

If you don’t do this already, use YouTube thumbnail images on your web site where you can.  It saves you the hassle of doing image management, and if you are loading more than one video on a page, you should be embedding the thumbnails and doing some Javascript work to load the YouTube video when a user chooses which they want to watch.  This will make your page load times SO much faster and more efficiently, and your visitors will love you for it.

YouTube Image URLs

The base URL to YouTube thumbnail image URL is http://img.youtube.com/vi. The video ID and the image format need to be added to the URL as well.

The full URL pattern looks like:

http://img.youtube.com/vi/YouTubeID/ImageFormat.jpg

The YouTubeID is unique to the video you are using, so that’s up to you to find from the YouTube video it self.

The ImageFormat portion of the URL can be chosen from the table below.

webp image versions

You can also request images in the webp image format if you’d like.  The same logic and image formats exist, you just need to use this alternate URL pattern. webp images are highly optimized images and thus are smaller in file size. This of course reduces page load time and makes a better user experience for website visitors. webp is great for mobile devices and all major desktop browsers support webp as well now.

http://img.youtube.com/vi_webp/YouTubeID/ImageFormat.webp

Alternate Domains

There are various domains that YouTube image thumbnail URLs can be requested from:

  • http://img.youtube.com
  • http://i.ytimg.com
  • http://i3.ytimg.com

HTTPS

All of these URLs can and should be called from HTTPS instead of HTTP

YouTube Thumbnail Image Options

Some of the image formats add what I’m calling 16×9 bars to the image.  What I mean is that the image is in a 4×3 aspect ratio (nearly square) yet the video it self is of a 16×9 aspect ratio (rectangular).  Because of this, black bars are added to the top and bottom of the 4×3 image where the 16×9 image leaves a void.

When a video is uploaded to YouTube, YouTube will generate 3 thumbnail images and designates one of those as the default.  The owner of the video can choose one of the other 2 images as the default.  In addition, the owner can upload a custom thumbnail image and use that as the default thumbnail.  In that scenario, images 1, 2, and 3 listed below are the three auto-generated images mentioned above, and image 0 would be the custom image uploaded (if set as default).

If you know of any other image formats that I’m missing here, please comment below – I’d love for this to become a complete resource for all to use.

ImageFormatSizeResolution16×9 BarsDefault Image
0480 x 360HighYesYes
1120 x 90LowYes

No

2120 x 90LowYesNo
3120 x 90LowYesNo
default120 x 90LowYesYes
mqdefault320 x 180MediumNo

Yes

hqdefault480 x 360HighYesYes
sddefault640 x 480HighYesYes
maxresdefault

Matches the resolution of the uploaded video

NOTE: May not be available for non-highres videos.

Highest possibleNoYes

Removing the 16×9 Bars

I’ve often wanted to use an image that has the 16×9 bars on it, but don’t want to show the black bars.  To do this, you’ll need to use the image as a background-image of an element, and use CSS to crop off the top and bottom bars.

Original Image from YouTube

Background Image with Bars Hidden

 

Example Embedded YouTube Thumbnail Images

ImageFormatURLExample
0https://promincproductions.com/blog/wp-content/uploads/2015/06/0.jpg
1https://promincproductions.com/blog/wp-content/uploads/2015/06/1.jpg
2https://promincproductions.com/blog/wp-content/uploads/2015/06/2.jpg
3https://promincproductions.com/blog/wp-content/uploads/2015/06/3.jpg
defaulthttps://promincproductions.com/blog/wp-content/uploads/2015/06/default.jpg
mqdefaulthttps://promincproductions.com/blog/wp-content/uploads/2015/06/mqdefault.jpg
hqdefaulthttps://promincproductions.com/blog/wp-content/uploads/2015/06/hqdefault.jpg
sddefaulthttps://promincproductions.com/blog/wp-content/uploads/2015/06/sddefault.jpg
maxresdefaulthttps://promincproductions.com/blog/wp-content/uploads/2015/06/maxresdefault-1.jpg
Example of the different YouTube Image Thumbnail sizes and displays

Other Options?

In YouTube itself, they use a URL like:

This is very intriguing – this would mean that you could actually come up with your own specifications to the image dimensions, etc.  However you can’t just drop in any video ID and get the same results.  It appears that the sigh query parameter is unique to this video or image.  So determining what the sigh query parameter is would allow us to create our own URLs that mimic this pattern and thus give us full reign to define custom images.

If anyone has more insight to what the sigh parameter is and how to set it I’d LOVE to hear from you.  Please comment below with your input.