Download a YouTube Thumbnail from the Command Line
Want it without a terminal? Paste a link above to grab every size in one click. Prefer curl, wget, or yt-dlp? The commands are below.
Want it without a terminal? Paste a link above to grab every size in one click. Prefer curl, wget, or yt-dlp? The commands are below.
A YouTube thumbnail is a plain, public image file, so you do not need a browser, an API key, or a scraper to save one. Any HTTP client, curl, wget, or yt-dlp, downloads it in a single command. This page gives the copy-paste commands, a fallback script that handles the missing-HD-file case, a loop for many videos at once, and the Windows PowerShell version. If you just want the image without opening a terminal, the YouTube thumbnail grabber does every size in one click.
Every command below downloads the same predictable address. Take the 11-character video ID from the link (after v= in a watch URL, after /shorts/ in a Shorts URL, or the path of a youtu.be link) and drop it into the pattern:
https://i.ytimg.com/vi/<VIDEO_ID>/maxresdefault.jpg HD 1280x720, HD uploads only
https://i.ytimg.com/vi/<VIDEO_ID>/sddefault.jpg 640x480, most videos
https://i.ytimg.com/vi/<VIDEO_ID>/hqdefault.jpg 480x360, every video
The img.youtube.com and i.ytimg.com hosts serve the same files, so either works. For the full list of files and when each one exists, see the YouTube thumbnail URL guide.
# Save the HD thumbnail, keeping the remote filename (maxresdefault.jpg)
curl -O https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg
# Save it under a name you choose, and fail cleanly on a 404
curl -f -o thumbnail.jpg https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg
-O keeps the remote name, -o sets your own, and -f makes curl return an error on a missing file instead of writing YouTube's error response into your image. Use -f whenever you request maxresdefault, because it is not guaranteed to exist.
wget https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg
# Choose the output name
wget -O thumbnail.jpg https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg
If you have the full video link rather than the bare ID, yt-dlp is the easiest route: it resolves the highest thumbnail the video actually has, so you never guess about maxresdefault.
# Save the best available thumbnail and skip the video download
yt-dlp --write-thumbnail --skip-download "https://www.youtube.com/watch?v=VIDEO_ID"
# Force the result to a .jpg (requires ffmpeg; YouTube may serve WebP)
yt-dlp --write-thumbnail --skip-download --convert-thumbnails jpg "https://www.youtube.com/watch?v=VIDEO_ID"
The most common bug in a download script is assuming maxresdefault.jpg always exists. It does not: for videos uploaded below 720p without a custom thumbnail it returns a 404, or on some CDN edges a gray 120x90 placeholder at HTTP 200. This small script tries the sizes in order and rejects the tiny placeholder by checking the saved file size:
#!/usr/bin/env bash
id="$1"
for f in maxresdefault sddefault hqdefault; do
url="https://i.ytimg.com/vi/$id/$f.jpg"
if curl -fsS -o "$id.jpg" "$url" && [ "$(wc -c < "$id.jpg")" -gt 2048 ]; then
echo "Saved $f for $id"; exit 0
fi
done
echo "No usable thumbnail for $id" >&2; exit 1
hqdefault.jpg exists for every video, so the loop always ends on a real image. Because maxresdefault at 1280x720 sits at the top of that chain, it is the sharpest a thumbnail comes in, there is no 1080p or 4K file to request, as YouTube thumbnail resolution explains.
Put one video ID per line in ids.txt and loop over it:
# ids.txt: one 11-character video ID per line
while read -r id; do
curl -fsS -o "$id.jpg" "https://i.ytimg.com/vi/$id/hqdefault.jpg"
done < ids.txt
Swap hqdefault for the fallback script above if you want the HD image where it exists. No terminal at hand? The bulk YouTube thumbnail downloader takes a list of links in the browser and returns every image with no code.
Invoke-WebRequest -Uri "https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg" -OutFile "thumbnail.jpg"
curl.exe, wget, and yt-dlp also run on Windows once installed, with the same syntax shown above.
i.ytimg.com works, but cache the files on your own side for production traffic rather than hitting YouTube on every request.Run curl -O https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg to save the HD image with its remote name, or curl -o thumbnail.jpg URL to choose the filename. Add -f so curl fails on a 404 instead of saving an error page, which matters because maxresdefault does not exist for every video.
Use yt-dlp --write-thumbnail --skip-download followed by the full watch URL. --skip-download tells it not to fetch the video, and --write-thumbnail saves the best available thumbnail. Add --convert-thumbnails jpg (it needs ffmpeg) if you want a JPG rather than the WebP that YouTube may serve.
No. Thumbnail files are public static images at i.ytimg.com, so curl, wget, and yt-dlp reach them with no API key, OAuth token, or quota. You only need the YouTube Data API for metadata such as titles or view counts.
YouTube only creates maxresdefault.jpg for HD uploads and custom thumbnails, so for other videos it returns a 404 (caught by curl -f) or, on some CDN edges, a gray 120x90 placeholder at HTTP 200. Fall back to sddefault then hqdefault, and check that the saved file is bigger than about 2KB so you reject the placeholder.
Put one 11-character video ID per line in a text file and loop over it with a shell while-read loop that calls curl for each ID. If you would rather not write a script, paste a list of links into the bulk YouTube thumbnail downloader and get every image in one pass.
In PowerShell, use Invoke-WebRequest -Uri "https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg" -OutFile "thumbnail.jpg". curl.exe and wget are also available on Windows once installed, and yt-dlp runs the same on Windows, macOS, and Linux.
Fetching a public thumbnail file for personal use is the same request YouTube itself makes. The image stays the creator's copyright, though, so credit the creator and get permission before republishing one. Cache the files on your own side rather than hotlinking i.ytimg.com in production.
Prefer not to touch a terminal at all? Paste any link into the YouTube thumbnail grabber and download every size in one click.