SyntaxStudy
Sign Up
HTML Embedding YouTube Videos
HTML Beginner 4 min read

Embedding YouTube Videos

Embedding YouTube

YouTube provides an embed URL for each video. Use it in an iframe to display the player on your page.

Add parameters to the URL to control player behavior like autoplay, loop, and related videos.

Example
<iframe
  width="560"
  height="315"
  src="https://www.youtube.com/embed/VIDEO_ID?rel=0&modestbranding=1"
  title="YouTube video player"
  frameborder="0"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen
></iframe>
Pro Tip

Add ?rel=0 to the YouTube URL to prevent unrelated videos from showing after playback ends.