Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use YouTube’s image-host pattern for a quick lookup: https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg. Replace VIDEO_ID with the video’s 11-character ID. If your application must know which thumbnail sizes actually exist, call the YouTube Data API’s videos.list method with part=snippet and read the URLs returned in snippet.thumbnails. The API method is more reliable because YouTube does not guarantee that every manually constructed variant exists for every video.

Find the video ID first

A video ID is the value YouTube uses to identify one video. In a normal watch link such as https://www.youtube.com/watch?v=7lCDEYXw3mM, the ID is the value after v=: 7lCDEYXw3mM. In a shortened link such as https://youtu.be/7lCDEYXw3mM, it is the path segment after the domain.

Do not copy the whole YouTube URL into the image path. Remove the query string and any other parameters first. For example, from https://www.youtube.com/watch?v=7lCDEYXw3mM&t=30s, use only 7lCDEYXw3mM.

Common places an ID appears

  • Watch URL: the value after v=.
  • Short URL: the first path segment after youtu.be/.
  • Embed URL: the segment after /embed/.

When accepting IDs from users, trim whitespace and validate the extracted value before inserting it into a URL. Treat the ID as data, not as an entire URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What is the YouTube thumbnail URL format?

The official YouTube API getting-started guide demonstrates this direct pattern: https://i.ytimg.com/vi/7lCDEYXw3mM/hqdefault.jpg. Replace the example ID with your own:

https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg

YouTube’s example also shows default.jpg and mqdefault.jpg. These are convenient URL patterns, but the documentation does not promise that every filename and every video combination will return an image. Check the response when the image is important to your application.

Typical thumbnail variants

Variant Typical dimensions Availability
default 120 × 90 Typically available
mqdefault or medium 320 × 180 Typically available
hqdefault or high 480 × 360 Typically available
sddefault or standard 640 × 480 Available for some videos
maxresdefault or maxres 1280 × 720 Available for some videos

The dimensions above are typical values documented for video thumbnail resources, not guarantees for every upload. Original video resolution and the individual resource determine which variants YouTube returns.

How do I get a thumbnail URL manually?

  1. Copy the video ID from the watch, shortened, or embed URL.
  2. Insert it into https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg.
  3. Open the resulting URL in a browser or use it as an HTML image source.
<img src="https://i.ytimg.com/vi/7lCDEYXw3mM/hqdefault.jpg" alt="Video thumbnail">

To try another documented filename, replace hqdefault.jpg with default.jpg or mqdefault.jpg. For larger images, you can test sddefault.jpg or maxresdefault.jpg, but handle a missing image because those sizes are only available for some videos.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I get the max-resolution thumbnail reliably?

There is no universal guarantee that maxresdefault.jpg exists. For software that needs the largest available image, request the video resource and inspect the thumbnail map returned by the API. YouTube documents this resource in Videos | YouTube Data API and describes the thumbnail fields in Thumbnails | YouTube Data API.

API request

Request the snippet part for one video ID. The request needs a YouTube Data API key associated with a Google Cloud project where the API is enabled:

curl "https://www.googleapis.com/youtube/v3/videos?part=snippet&id=VIDEO_ID&key=YOUR_API_KEY"

The response contains an items array. For a found video, inspect items[0].snippet.thumbnails. Each returned entry has a URL and may include width and height:

{
  "items": [
    {
      "snippet": {
        "thumbnails": {
          "default": { "url": "...", "width": 120, "height": 90 },
          "high": { "url": "...", "width": 480, "height": 360 },
          "maxres": { "url": "...", "width": 1280, "height": 720 }
        }
      }
    }
  ]
}

Choose the largest returned variant

Do not assume the maxres key is present. A robust client examines the keys that were returned and chooses the largest available width and height, or follows a preference order with a fallback:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const preferred = ["maxres", "standard", "high", "medium", "default"];
const thumbnails = item.snippet.thumbnails;
const key = preferred.find(name => thumbnails[name]);
if (!key) throw new Error("No thumbnail URL was returned");
const thumbnailUrl = thumbnails[key].url;

The API is the right choice when a missing image would break a page, when you need dimensions, or when you process many videos. It gives you the variants available for that specific resource instead of making you guess.

API retrieval in Python and JavaScript

Python

import requests

video_id = "7lCDEYXw3mM"
params = {
    "part": "snippet",
    "id": video_id,
    "key": "YOUR_API_KEY",
}
response = requests.get(
    "https://www.googleapis.com/youtube/v3/videos",
    params=params,
    timeout=30,
)
response.raise_for_status()
data = response.json()

if not data.get("items"):
    raise ValueError("Video was not found or is not accessible")

thumbnails = data["items"][0]["snippet"].get("thumbnails", {})
for name in ("maxres", "standard", "high", "medium", "default"):
    if name in thumbnails:
        print(thumbnails[name]["url"])
        break
else:
    raise ValueError("No thumbnail URL was returned")

Node.js

const videoId = '7lCDEYXw3mM';
const key = 'YOUR_API_KEY';
const endpoint = new URL('https://www.googleapis.com/youtube/v3/videos');
endpoint.search = new URLSearchParams({ part: 'snippet', id: videoId, key });

const response = await fetch(endpoint);
if (!response.ok) throw new Error(`YouTube API returned ${response.status}`);
const data = await response.json();
const item = data.items?.[0];
if (!item) throw new Error('Video was not found or is not accessible');

const thumbnails = item.snippet?.thumbnails ?? {};
const name = ['maxres', 'standard', 'high', 'medium', 'default']
  .find(candidate => thumbnails[candidate]);
if (!name) throw new Error('No thumbnail URL was returned');
console.log(thumbnails[name].url);

Keep the API key on your server rather than exposing it in browser code. Cache the returned URL when appropriate, and still handle an image request that later fails.

Why does maxresdefault not work?

The video does not have that variant

Standard and max-resolution thumbnails are available only for some videos. A manually assembled URL may therefore return a missing image or a lower-quality fallback. Use videos.list and select a key that appears in snippet.thumbnails.

The ID is wrong or includes extra characters

Recheck whether you copied a timestamp, playlist parameter, trailing slash, or whitespace along with the ID. Extract only the identifier from the original URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You are using search metadata for an unsupported size

The Search API documents default through maxres variants, but says fhd, qhd, and uhd are not supported in search results. For higher-resolution metadata tied to one video, use a video-specific resource such as videos.list. See Search | YouTube Data API.

The API response has no items

An empty items array means the requested resource was not returned. Confirm the ID, API key, API enablement, quota, and the video’s access status. Do not index into items[0] without checking it exists.

The image loads but looks stretched

Use the width and height returned with the selected thumbnail, preserve its aspect ratio, and avoid forcing a 16:9 box onto a 4:3 variant such as some high-resolution resources.

Search thumbnails versus video thumbnails

Search results can include thumbnail metadata, but search has its own documented limits. If your input is already a known video ID, calling videos.list avoids an unnecessary search request and gives metadata for that exact video. The search documentation is at https://developers.google.com/youtube/v3/docs/search.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not confuse retrieval with thumbnails.set

Thumbnails: set | YouTube Data API uploads and associates a custom thumbnail with a video. It is not an endpoint for discovering the current thumbnail URL. To retrieve existing thumbnail metadata, use the video resource’s snippet.thumbnails map.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to capture a complete web page rather than obtain YouTube’s existing thumbnail asset, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF. Its cleanup steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled.

ScreenshotNeo bills only clean shots. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

One-call example

See the full parameter reference in the ScreenshotNeo documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

It also supports full-page captures, CSS-selector elements, device presets, retina scale, PDF options, custom CSS and JavaScript, click and wait actions, blocked resources, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification.

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan. Sign up for the free ScreenshotNeo plan.

Practical decision guide

Your requirement Best approach
One thumbnail for a page or script Construct the hqdefault.jpg URL from the ID and verify it loads.
Largest available image Call videos.list, inspect snippet.thumbnails, and choose the largest returned entry.
Known dimensions and dependable fallback Use API metadata, then fall back from maxres to standard, high, medium, or default.
Search-driven results Use Search API metadata, observing its unsupported fhd, qhd, and uhd limitation.
Set a new custom thumbnail Use thumbnails.set; it does not retrieve an existing image.

Frequently Asked Questions

Can I get a YouTube thumbnail URL without an API key?

Yes. For a quick lookup, construct the documented i.ytimg.com URL with the video ID. An API key is needed when your software calls the YouTube Data API to inspect returned variants.

Is maxresdefault always 1280 × 720?

1280 × 720 is the typical documented maxres size. The variant itself may be absent, and dimensions can vary with the source video, so use the dimensions returned by the API when available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can thumbnails.set return the current thumbnail?

No. thumbnails.set uploads and associates a custom image. Retrieve existing thumbnail URLs from the video resource’s snippet.thumbnails map.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.