YouTube Embed Code Generator
Get responsive iframe HTML to embed a YouTube video, with optional start time, autoplay, loop and privacy mode.
What is the YouTube Embed Code Generator?
This tool creates responsive iframe HTML to embed a YouTube video on a web page. Paste a video link or ID, then choose an optional start time, autoplay, loop and privacy-enhanced mode. Copy the code into your page. The player keeps a 16:9 shape and resizes with its container.
How to use it
- Paste the YouTube video link or the 11-character video ID.
- Set a start time in seconds if the video should begin part-way through.
- Tick autoplay, loop or privacy-enhanced mode as needed.
- Copy the HTML into your page and preview it on a phone and a computer.
YouTube Embed Code Generator — FAQ
What does privacy-enhanced mode do?
It uses YouTube's youtube-nocookie.com address, which is intended to limit tracking until the visitor plays the video. Check YouTube's current documentation for exact behaviour.
Why does autoplay not always work?
Browsers often block videos with sound from playing on their own. Visitors may still need to tap play, so do not rely on autoplay.
How is looping set up?
A loop needs the video to also be given as a playlist of one, so the code adds that automatically when you tick loop.