Enter YouTube Video URL or Video ID
Extracts maximum resolution image assets directly from Google's high-speed CDN servers.
Supported Patterns:
youtube.com/watch?v=ID
youtu.be/ID
youtube.com/shorts/ID
youtube.com/embed/ID
youtube.com/live/ID
11-Char Raw ID
HQ Default (480 × 360)
4:3 Ratio
SD Default (640 × 480)
4:3 Ratio
MQ Default (320 × 180)
16:9 Widescreen
YouTube Thumbnail CDN Resolution Reference & Specifications
YouTube's distributed content delivery network serves multiple thumbnail renditions under predictable URI paths. This tool reverse-engineers the canonical URL endpoints to access raw source assets without browser downsampling.
| Quality Tier | Pixel Dimensions | Aspect Ratio | Canonical CDN Resource Path | Recommended Application |
|---|---|---|---|---|
| Ultra HD (MaxRes) | 1920 × 1080 |
16:9 Widescreen | /vi/{id}/maxresdefault.jpg |
4K Displays, presentations, YouTube channel banners |
| Standard Def (SD) | 640 × 480 |
4:3 Aspect | /vi/{id}/sddefault.jpg |
Article featured images, Open Graph social share tags |
| High Quality (HQ) | 480 × 360 |
4:3 Aspect | /vi/{id}/hqdefault.jpg |
Universal fallback guaranteed on 100% of YouTube uploads |
| Medium Quality (MQ) | 320 × 180 |
16:9 Widescreen | /vi/{id}/mqdefault.jpg |
Mobile app feeds, newsletters, ultra low-bandwidth embeds |
YouTube Video ID & Thumbnail Extraction Code Snippets
// Comprehensive YouTube Video ID RegEx & CDN Constructor
function getYouTubeThumbnail(url, quality = "maxresdefault") {
const regExp = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?|shorts|live)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/i;
const match = url.match(regExp);
const videoId = match ? match[1] : (url.length === 11 ? url : null);
if (!videoId) throw new Error("Invalid YouTube URL");
return {
videoId,
jpg: `https://img.youtube.com/vi/${videoId}/${quality}.jpg`,
webp: `https://i.ytimg.com/vi_webp/${videoId}/${quality}.webp`
};
}
import re
def extract_yt_thumbnail(url: str, quality: str = "maxresdefault") -> dict:
"""Extracts YouTube video ID and returns direct CDN thumbnail URLs."""
pattern = r'(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?|shorts|live)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})'
match = re.search(pattern, url)
video_id = match.group(1) if match else (url if len(url) == 11 else None)
if not video_id:
raise ValueError("Invalid YouTube URL or ID.")
return {
"id": video_id,
"maxres": f"https://img.youtube.com/vi/{video_id}/{quality}.jpg",
"hq": f"https://img.youtube.com/vi/{video_id}/hqdefault.jpg"
}
<?php
function getYouTubeThumbnails(string $url): ?array {
$pattern = '/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?|shorts|live)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/i';
if (preg_match($pattern, $url, $matches)) {
$id = $matches[1];
} elseif (strlen(trim($url)) === 11) {
$id = trim($url);
} else {
return null;
}
return [
'id' => $id,
'maxres' => "https://img.youtube.com/vi/{$id}/maxresdefault.jpg",
'sd' => "https://img.youtube.com/vi/{$id}/sddefault.jpg",
'hq' => "https://img.youtube.com/vi/{$id}/hqdefault.jpg",
'mq' => "https://img.youtube.com/vi/{$id}/mqdefault.jpg"
];
}
package main
import (
"fmt"
"regexp"
)
func GetYouTubeThumb(url string) (string, error) {
re := regexp.MustCompile(`(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?|shorts|live)\/|.*[?&]v=)|youtu\.be\/)([^"&?/\s]{11})`)
matches := re.FindStringSubmatch(url)
if len(matches) < 2 {
return "", fmt.Errorf("invalid youtube URL")
}
return fmt.Sprintf("https://img.youtube.com/vi/%s/maxresdefault.jpg", matches[1]), nil
}