Skip to content

Instantly share code, notes, and snippets.

@bitsurgeon
Last active June 5, 2026 09:22
Show Gist options
  • Select an option

  • Save bitsurgeon/acd769ae3236c48a433e0acb11784c2e to your computer and use it in GitHub Desktop.

Select an option

Save bitsurgeon/acd769ae3236c48a433e0acb11784c2e to your computer and use it in GitHub Desktop.
Markdown cheatsheet for YouTube

Embed YouTube Video in Markdown File

  1. Markdown style
[![Watch the video](https://img.youtube.com/vi/nTQUwghvy5Q/default.jpg)](https://youtu.be/nTQUwghvy5Q)
  1. HTML style
<a href="http://www.youtube.com/watch?feature=player_embedded&v=nTQUwghvy5Q" target="_blank">
 <img src="http://img.youtube.com/vi/nTQUwghvy5Q/mqdefault.jpg" alt="Watch the video" width="240" height="180" border="10" />
</a>
  1. embed thumbnail
![alt text][image]
[image]: /full/path/to/image/file.jpg "alt_txt"
  1. resize thumbnail
<img src="/full/path/to/image/file.jpg" alt="alt_text" width="200">

Extras on Thumbnail Format

Each YouTube video has 4 generated images. The first one in the list is a full size image and others are thumbnail images. They are predictably formatted as follows:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg

The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg  

Other than the default.jpg, the following thumbnail formats are also available:

  • hqdefault.jpg <- high quality
  • mqdefault.jpg <- medium quality
  • sddefault.jpg <- standard definition
  • maxresdefault.jpg <- maximum resolution

NB: sddefault.jpg and maxresdefault.jpg are not always available.

All of the above urls are available over http too. Additionally, the slightly shorter hostname i3.ytimg.com works in place of img.youtube.com in the example urls above.

ghost commented Jul 13, 2022

Copy link
Copy Markdown

thanks man :)

@esthicodes

Copy link
Copy Markdown

danke :)

@pdxlocations

Copy link
Copy Markdown

Very helpful, thank you!

@AhmedRaja1

Copy link
Copy Markdown

Thanks!

@mayurbagga

Copy link
Copy Markdown

only image is getting open

@git-ritesh

Copy link
Copy Markdown

Thanks! 🙂

@tiavina-mika

Copy link
Copy Markdown

the video is not opened, only the thumbnail are displayed

@symsoph

symsoph commented Dec 9, 2024

Copy link
Copy Markdown

thank you! i never knew about this thumbnail stuff

@fer-correa

Copy link
Copy Markdown

Thanks, it's very helpful!

@avipars

avipars commented Sep 6, 2025

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment