ThumbnailsGrabber.com

YouTube Thumbnail URL Format

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.

The Base URL Pattern

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.

Every Thumbnail File YouTube Stores

FileResolutionAspectAvailability
maxresdefault.jpg1280x72016:9HD uploads and custom thumbnails only
sddefault.jpg640x4804:3 (letterboxed)Most videos
hqdefault.jpg480x3604:3 (letterboxed)Every video
mqdefault.jpg320x18016:9Every video
default.jpg120x904:3Every video
0.jpg480x3604:3Every video (same as hqdefault)
1.jpg 2.jpg 3.jpg120x904:3Auto frames from start, middle, end
hq720.jpg1280x72016:9HD uploads, same availability as maxresdefault
oar2.jpgVertical9:16Most 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.

WebP Versions

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

Live Stream Thumbnails

Active live streams refresh their thumbnail at a _live suffix:

https://i.ytimg.com/vi/<VIDEO_ID>/hqdefault_live.jpg

The maxresdefault Trap (and the Right Fallback Chain)

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.

JavaScript

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);
  });
}

Python

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"

Extracting the Video ID

const ID_RE = /(?:v=|\/(?:shorts|embed|live|v)\/|youtu\.be\/)([0-9A-Za-z_-]{11})/;
const id = (url.match(ID_RE) || [])[1];

Usage Notes

Frequently asked questions

What is the URL of a YouTube thumbnail?

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.

How do I get a YouTube thumbnail URL from a video link?

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.

Why does maxresdefault.jpg return a 404?

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.

How do I check whether a thumbnail actually exists?

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.

Do I need an API key to get YouTube thumbnails?

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.

Do YouTube thumbnails exist in WebP?

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.

Is oar2.jpg only for YouTube Shorts?

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.

Can I hotlink YouTube thumbnail images?

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.