YouTube Thumbnail URL Format
Every size YouTube stores, when each file exists, and copy-paste code for the right fallback chain.
Every size YouTube stores, when each file exists, and copy-paste code for the right fallback chain.
Every public YouTube video exposes its thumbnails at predictable addresses. You do not need an API key, OAuth, or scraping. This page lists every known thumbnail file, when each one exists, and how to use them in code. Because these addresses are public, nothing needs to be installed to reach them, so a browser Chrome extension for downloading thumbnails is optional at best. Bookmark it; nothing here requires our tool, though the YouTube thumbnail downloader does it in one click. To pull these files from a script or terminal instead, see how to download a thumbnail from the command line. Because the address is public and stable, it is also what you place in a page's VideoObject thumbnailUrl field so your video can show a thumbnail in Google search.
https://img.youtube.com/vi/<VIDEO_ID>/<FILE>.jpg
https://i.ytimg.com/vi/<VIDEO_ID>/<FILE>.jpg (same files, CDN host)
The VIDEO_ID is the 11-character code in any YouTube link: after v= in a watch URL, after /shorts/ in a Shorts URL, or the path of a youtu.be link.
| File | Resolution | Aspect | Availability |
|---|---|---|---|
maxresdefault.jpg | 1280x720 | 16:9 | HD uploads and custom thumbnails only |
sddefault.jpg | 640x480 | 4:3 (letterboxed) | Most videos |
hqdefault.jpg | 480x360 | 4:3 (letterboxed) | Every video |
mqdefault.jpg | 320x180 | 16:9 | Every video |
default.jpg | 120x90 | 4:3 | Every video |
0.jpg | 480x360 | 4:3 | Every video (same as hqdefault) |
1.jpg 2.jpg 3.jpg | 120x90 | 4:3 | Auto frames from start, middle, end |
hq720.jpg | 1280x720 | 16:9 | HD uploads, same availability as maxresdefault |
oar2.jpg | Vertical | 9:16 | Most Shorts, and many regular videos too (see our Shorts downloader) |
The letterboxed 4:3 files (hqdefault, sddefault, 0.jpg) include black bars above and below the 16:9 image. If you need clean 16:9 with guaranteed availability, use mqdefault.jpg. Note that oar2.jpg is not exclusive to Shorts: it resolves for many ordinary 16:9 uploads as well, and it is missing on some, so treat it as optional and always check it before you rely on it. For recommended upload sizes and pixel dimensions in one place, see the YouTube thumbnail sizes and dimensions guide. To use one of the auto-generated frames (1.jpg, 2.jpg, 3.jpg) as a screenshot of the video, or to capture an exact moment yourself, see how to screenshot a YouTube video. Those single frames are still cover-style images; the moving preview stills you see when you hover the progress bar are a different, signed image type, explained in the YouTube storyboard images guide.
YouTube serves smaller WebP files from the vi_webp path:
https://i.ytimg.com/vi_webp/<VIDEO_ID>/hqdefault.webp
https://i.ytimg.com/vi_webp/<VIDEO_ID>/mqdefault.webp
Active live streams refresh their thumbnail at a _live suffix:
https://i.ytimg.com/vi/<VIDEO_ID>/hqdefault_live.jpg
That path is a low-resolution developer endpoint, not a download-quality image. To simply save the HD graphic a live stream or premiere shows, see how to download a YouTube live stream thumbnail.
The most common bug in thumbnail code: assuming maxresdefault.jpg always exists. It does not. For videos uploaded below 720p without a custom thumbnail, that URL returns a 404 whose body is a gray 120x90 placeholder JPEG. Use this fallback order: maxresdefault, then sddefault, then hqdefault, which always exists. If a thumbnail is not showing or not updating in a browser or a link preview, this missing-file behaviour or a downstream cache is usually why. If instead every size comes back as that placeholder, the cause may be the video rather than the file: see which private, unlisted, and deleted videos still have a public thumbnail. For a broken image on your own site specifically, work through why a YouTube thumbnail is not loading. And because maxresdefault at 1280x720 sits at the top of that chain, it is the highest resolution any thumbnail comes in: there is no 1080p or 4K file to request, as YouTube thumbnail resolution explains. How often the trap actually bites is measured in our YouTube thumbnail statistics study: across 8,664 public videos, maxresdefault was missing for 11.7%, and every missing request came back as a 404 whose body is the grey placeholder.
function getThumbnail(videoId) {
const files = ['maxresdefault', 'sddefault', 'hqdefault'];
return new Promise((resolve) => {
const tryNext = (i) => {
const img = new Image();
const url = `https://i.ytimg.com/vi/${videoId}/${files[i]}.jpg`;
img.onload = () => (img.naturalWidth > 120 || i === files.length - 1) ? resolve(url) : tryNext(i + 1);
img.onerror = () => tryNext(i + 1);
img.src = url;
};
tryNext(0);
});
}
If you would rather not maintain this yourself, the same fallback (an HTTP status check plus a real pixel-width check on the first 4 KB, so the 404 placeholder body is rejected) ships as our open-source npm package youtube-thumbnail-url: MIT, zero dependencies, Node 18+ and browsers, ESM and CommonJS, with TypeScript types (source on GitHub). npm install youtube-thumbnail-url, then await resolveThumbnail('https://youtu.be/dQw4w9WgXcQ') returns the largest size that really exists.
import requests
def get_thumbnail(video_id: str) -> str:
for f in ("maxresdefault", "sddefault", "hqdefault"):
url = f"https://i.ytimg.com/vi/{video_id}/{f}.jpg"
if requests.head(url, timeout=5).status_code == 200:
return url
return f"https://i.ytimg.com/vi/{video_id}/hqdefault.jpg"
For a fuller Python walkthrough, the placeholder-safe fallback, a URL parser, and a batch loop, see how to download a YouTube thumbnail in Python.
const ID_RE = /(?:v=|\/(?:shorts|embed|live|v)\/|youtu\.be\/)([0-9A-Za-z_-]{11})/;
const id = (url.match(ID_RE) || [])[1];
https://www.youtube.com/oembed?url=...&format=json) also returns a thumbnail_url field if you prefer an API-style call. Vimeo has the same kind of endpoint; see how to get a Vimeo thumbnail URL from a video ID, where the size is a suffix on the address rather than a fixed file name.Every YouTube thumbnail lives at https://img.youtube.com/vi/VIDEO_ID/FILE.jpg, where FILE is one of default, mqdefault, hqdefault, sddefault, or maxresdefault. The i.ytimg.com host serves the same files from the same paths, so the two hosts are interchangeable.
Pull the 11-character video ID out of the link, then drop it into the pattern above. The ID follows v= in a watch URL, /shorts/ in a Shorts URL, or the path in a youtu.be link. The regular expression in the Extracting the Video ID section handles all of those formats in one pass.
YouTube only creates maxresdefault.jpg for videos uploaded in HD or given a custom thumbnail. Older and low-resolution uploads never get that file. Fall back to hqdefault.jpg, which exists for every video.
From a server, a missing file is a clean 404, so a HEAD request and a status check is enough. In a browser it is not: the 404 body is still a gray 120x90 placeholder JPEG (1,014 of 1,014 missing files in our 8,664-video study), and browsers render that body and fire the load event, so no error is raised. That is why the JavaScript sample on this page checks naturalWidth greater than 120 rather than trusting onload alone.
No. Thumbnail URLs are public static files, so no API key, OAuth token, or quota is involved. You only need the YouTube Data API if you want metadata such as titles, view counts, or the exact list of thumbnails a video has.
Yes. Swap the path segment vi for vi_webp and the extension to .webp, for example https://i.ytimg.com/vi_webp/VIDEO_ID/hqdefault.webp. The WebP files are noticeably smaller than the JPG versions.
No. oar2.jpg is the vertical 9:16 image and it is most useful for Shorts, but it also resolves for many ordinary 16:9 uploads, and it is absent on some videos. Treat it as an optional file: request it, and fall back to a standard size if it is missing.
Technically yes, and it is how YouTube itself serves them, but cache the files on your own side for production traffic. The images stay the creator's copyright, so credit the creator when you republish a thumbnail. For the practical patterns, a clickable image, a click-to-load facade, or a blog featured image, see how to embed a YouTube thumbnail. For when permission or fair use is required, see the rules on using someone else's thumbnail.
Prefer not to write code at all? Paste any link into the YouTube thumbnail grabber and download every size in one click.