HTML Tutorial

The language for building web pages.

HTML YouTube

Embedding YouTube Videos

The easiest way to play videos in HTML is to use YouTube. YouTube will handle video hosting, encoding, and playback across all devices. You can embed any YouTube video using an <iframe>.

How to Get Embed Code:

  1. Go to the YouTube video
  2. Click Share → Embed
  3. Copy the <iframe> code
  4. Paste into your HTML

Useful Parameters:

  • autoplay=1 - Auto play
  • mute=1 - Mute audio
  • loop=1 - Loop video
  • controls=0 - Hide controls
  • start=30 - Start at 30 seconds

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics