tutorials|March 04, 2018|1 min read

How to get Youtube Video Thumbnail Images

TL;DR

YouTube exposes public thumbnail URLs at img.youtube.com/vi/{VIDEO_ID}/ in various resolutions (default, medium, high, standard, maxres) that anyone can use.

How to get Youtube Video Thumbnail Images

Problem

You know your youtube URL. And, you want to know its thumbnail image that you can use on your website, or somewhere. Note: Video can be any video on youtube.com website.

Get Youtube Thumbnail Images

Youtube provides video's thumbnails publically available to users. Anyone can use them. Youtube provides multiple resolution images. You need to know the video id.

If your youtube video looks like:https://www.youtube.com/watch?v=g0kFl7sBdDQ

Then, your video id is:g0kFl7sBdDQ

There are two ways to get thumbnail URL:

  1. Get URL from any of following possible URLs:
    1. https://i.ytimg.com/vi/<video_id>/default.jpg
      Having dimensions: 120x90
      This is the default image.
    2. https://i.ytimg.com/vi/<video_id>/mqdefault.jpg
      Having dimensions: 320x180
      This is called medium size thumbnail.
    3. https://i.ytimg.com/vi/<video_id>/hqdefault.jpg
      Having dimensions: 480x360
      This is called high size thumbnail.
    4. https://i.ytimg.com/vi/<video_id>/sddefault.jpg
      Having dimensions: 640x480
      This is called standard size.
    5. https://i.ytimg.com/vi/<video_id>/maxresdefault.jpg
      Having dimensions: 1280x720
      This is the maximum resolution available
  2. Use Youtube Rest APIs
    See: Using Youtube Rest APIs

Enjoy.

Related Posts

Drupal Helpful codes for database queries

Drupal Helpful codes for database queries

Being a drupal user from last around 5 years, I used to know small codes for…

Curl - Your friend for Rest APIs/Calls - Basic Commands

Curl - Your friend for Rest APIs/Calls - Basic Commands

Curl is a wonderful tool for initiate REST APIs or calls. Or, you can literally…

Docker image for Drupal 7, and Php extension MongoDB installed.

Docker image for Drupal 7, and Php extension MongoDB installed.

You have drupal 7 image from docker hub, and want to connect tomongo db via php…

Docker Push&#58; How to push your docker image to your organization in hub.docker.com

Docker Push&#58; How to push your docker image to your organization in hub.docker.com

Tag the image, by seeing its image id, from docker images command docker tag 04d…

Youtube API in NodeJs, Usage with Example

Youtube API in NodeJs, Usage with Example

This library is ES6, promise compatible. Or, in your package.json file, include…

Jira Rest APIs common usages

Jira Rest APIs common usages

This article shows some of common usages of JIRA rest apis. Note: This article…

Latest Posts

Claude Code Skills — Build a Better Engineering Workflow with AI-Powered Code Reviews, Security Scans, and More

Claude Code Skills — Build a Better Engineering Workflow with AI-Powered Code Reviews, Security Scans, and More

Most developers use Claude Code like a search engine — ask a question, get an…

Server Security Best Practices — Complete Hardening Guide for Production Systems

Server Security Best Practices — Complete Hardening Guide for Production Systems

Every breach post-mortem tells the same story: an unpatched service, a…

Staff Engineer Study Plan for MAANG Interviews — The Complete 12-Week Roadmap

Staff Engineer Study Plan for MAANG Interviews — The Complete 12-Week Roadmap

If you’re a Senior Engineer (L5) preparing for Staff (L6+) roles at MAANG…

XSS and CSRF Explained — The Complete Guide with Real Attack Examples and Defenses

XSS and CSRF Explained — The Complete Guide with Real Attack Examples and Defenses

XSS and CSRF have been in the OWASP Top 10 for over a decade. They’re among the…

OWASP Top 10 (2021) — Every Vulnerability Explained with Code

OWASP Top 10 (2021) — Every Vulnerability Explained with Code

The OWASP Top 10 is the industry standard for web application security risks. If…

HTTP Cookies Security — Everything Developers Get Wrong

HTTP Cookies Security — Everything Developers Get Wrong

Cookies are the single most important mechanism for web authentication. Every…