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. Bookmark it; nothing here requires our tool, though the thumbnail grabber does it in one click.
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.
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
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 (or a gray 120x90 placeholder via some CDN edges). 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.
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);
});
}
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"
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.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: some CDN edges answer a missing file with a gray 120x90 placeholder at HTTP 200 instead of an error, so the load event fires and 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.
Prefer not to write code at all? Paste any link into the YouTube thumbnail grabber and download every size in one click.