This is an in-case-you-didn’t-already-know tip, and is probably common knowledge to anyone who started writing YouTube scripts after v3 of the YouTube API came out. The gist is that in addition to the tiny thumbnail images that have always been available at a url containing the video id, you can also get a range of qualities and sizes.

Here’s an example url that will grab the largest image size available for video id M5avz98UJXM:

The quality/size is specified in the name of the requested JPG. Other options include:

  • default.jpg (120x90 pixel default thumbnail)
  • mqdefault.jpg (320x180)
  • hqdefault.jpg (480x360, letterboxed)
  • sddefault.jpg (640x480, letterboxed)
  • 0, 1, 2, or 3.jpg (small start, middle, and end frame thumbnails)

The default thumbnail can be set on your own videos using the video dashboard in YouTube. For other people’s videos, all of the above options will return whatever they’ve set or YouTube has chosen automatically. I haven’t seen an option to get higher quality versions of the 0-3 frames.

Note that the maxresdefault.jpg and mqdefault.jpg options do not have letterboxing (black stripes at top and bottom) added, but hqdefault.jpg and sddefault.jpg do.

I updated the JavaScript portion of my Lazy YouTube plugin for Jekyll (details) to use maxresdefault.jpg a while ago. I’d love to find an option to load @1x and @2x sizes based on screen resolution detection, but for now it’s max quality or bad quality.