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.
Contents
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.
ImageFormat | Size | Resolution | 16×9 Bars | Default Image |
---|---|---|---|---|
0 | 480 x 360 | High | Yes | Yes |
1 | 120 x 90 | Low | Yes | No |
2 | 120 x 90 | Low | Yes | No |
3 | 120 x 90 | Low | Yes | No |
default | 120 x 90 | Low | Yes | Yes |
mqdefault | 320 x 180 | Medium | No | Yes |
hqdefault | 480 x 360 | High | Yes | Yes |
sddefault | 640 x 480 | High | Yes | Yes |
maxresdefault | Matches the resolution of the uploaded video NOTE: May not be available for non-highres videos. | Highest possible | No | Yes |
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
Other Options?
In YouTube itself, they use a URL like:
1 | https://i.ytimg.com/vi/gp66iFdRB1c/hqdefault.jpg?custom=true&w=196&h=110&stc=true&jpg444=true&jpgq=90&sp=68&sigh=LsmavCnhh0YCRQ0D-IW_vjDslqY |
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.