Made with ❤️ by Anton Vasetenkov
How to embed a YouTube video into Markdown?
Apr 2, 2020

How to embed a YouTube video into Markdown?

Ways to insert a YouTube player into a Markdown document.

There are different ways to embed a YouTube video in Markdown documents.

If the Markdown processor supports inline HTML, a YouTube player can be embedded using an iframe:

    allow="autoplay; encrypted-media"

If the Markdown processor does not support inline HTML, the only way to add a video is to add an image that links to the video. You can use your own image or the thumbnail generated by YouTube. YouTube provides the following thumbnails for each video:

https://img.youtube.com/vi/VIDEO_ID/0.jpgFull-size thumbnail
https://img.youtube.com/vi/VIDEO_ID/1.jpg, https://img.youtube.com/vi/VIDEO_ID/2.jpg, https://img.youtube.com/vi/VIDEO_ID/3.jpgSmall thumbnail images
https://img.youtube.com/vi/VIDEO_ID/default.jpgDefault thumbnail image
https://img.youtube.com/vi/VIDEO_ID/hqdefault.jpgHigh-quality default thumbnail image
https://img.youtube.com/vi/VIDEO_ID/mqdefault.jpgMedium-quality default thumbnail image
https://img.youtube.com/vi/VIDEO_ID/sddefault.jpgStandard-definition default thumbnail image
https://img.youtube.com/vi/VIDEO_ID/maxresdefault.jpgMaximum-resolution default thumbnail image

Additionally, i.ytimg.com can be used in place of img.youtube.com in all of the URLs listed above.

Using one of the thumbnails, it is possible to add a link with a still from a video, e.g.: