NEWMeet the new Video Gallery — YouTube, TikTok, Instagram Reels, Vimeo and Twitch in one widget.
Guide

How to Autoplay Embedded YouTube Videos

Updated September 2026 · 22 min read

Key takeaways

  • Add autoplay=1&mute=1 to the embed URL — browsers only allow muted autoplay reliably.

  • Add playsinline=1 for iPhone and allow="autoplay" on the iframe.

  • Loop a single video with loop=1&playlist=VIDEO_ID.

  • Start autoplay only when the video is visible or when a popup opens.

The autoplay embed code

<iframe src="https://www.youtube.com/embed/VIDEO_ID?autoplay=1&mute=1&playsinline=1"
  title="YouTube video" allow="autoplay; encrypted-media; picture-in-picture"
  allowfullscreen></iframe>

Or generate it with our YouTube embed code generator — turn on Autoplay.

Autoplay and loop

To loop, add loop=1&playlist=VIDEO_ID — YouTube loops a single video only when the playlist parameter repeats its ID.

Why YouTube autoplay doesn’t work

  • mute=1 is missing.

  • The iframe lacks allow="autoplay".

  • The video owner disabled embedding.

  • On iPhone, playsinline=1 is missing.

Autoplay in a gallery

YouTube player parameters for autoplay and playback

Parameter
Value
What it does
autoplay
1
Starts the video automatically (muted in most browsers)
mute
1
Starts muted — required for reliable autoplay
loop
1
Loops the video; for a single video also set playlist=VIDEO_ID
playlist
VIDEO_ID
Needed for loop on a single video
playsinline
1
Plays inline on iPhone instead of fullscreen
controls
0 or 1
Hides or shows the player controls
start / end
seconds
Starts or stops at a given time
rel
0
Related videos come from the same channel

autoplay

Value

1

What it does

Starts the video automatically (muted in most browsers)

mute

Value

1

What it does

Starts muted — required for reliable autoplay

loop

Value

1

What it does

Loops the video; for a single video also set playlist=VIDEO_ID

playlist

Value

VIDEO_ID

What it does

Needed for loop on a single video

playsinline

Value

1

What it does

Plays inline on iPhone instead of fullscreen

controls

Value

0 or 1

What it does

Hides or shows the player controls

start / end

Value

seconds

What it does

Starts or stops at a given time

rel

Value

0

What it does

Related videos come from the same channel

Full list: YouTube embedded player parameters.

Autoplay only when the video scrolls into view

Autoplaying a video far down the page wastes bandwidth. Use the IFrame API and an IntersectionObserver to start it only when visible:

<div id="yt"></div>
<script src="https://www.youtube.com/iframe_api"></script>
<script>
  let player;
  function onYouTubeIframeAPIReady() {
    player = new YT.Player("yt", {
      videoId: "VIDEO_ID",
      playerVars: { mute: 1, playsinline: 1, rel: 0 }
    });
    new IntersectionObserver(([e]) => {
      if (!player.playVideo) return;
      e.isIntersecting ? player.playVideo() : player.pauseVideo();
    }, { threshold: 0.5 }).observe(document.getElementById("yt"));
  }
</script>

Autoplay YouTube in WordPress, Shopify, Wix and Squarespace

  • WordPress: the Embed block doesn’t expose autoplay — paste an iframe with autoplay=1&mute=1 into a Custom HTML block.

  • Shopify: add the iframe to a Custom Liquid section.

  • Wix: use Embed HTML with the iframe code.

  • Squarespace: use a Code block with the iframe.

Our YouTube embed code generator builds the iframe with the right parameters.

Troubleshooting checklist

  1. Is it muted?

    Without mute=1 most browsers block autoplay.

  2. Is autoplay allowed in the iframe?

    The allow attribute must include autoplay.

  3. Is it inside a hidden tab or popup?

    Players that start hidden may not autoplay; start them when shown.

  4. Is embedding allowed?

    Some videos disable embedding — they won’t play on other sites.

  5. Does the page use a cookie banner?

    Consent tools can block YouTube until visitors accept.

Good practice for autoplay

  • Autoplay short, silent clips; let people start longer videos themselves.

  • Show captions so muted autoplay still communicates.

  • Avoid several autoplaying videos on one page.

Why browsers block autoplay with sound

Unexpected sound is one of the most common complaints about websites, so browsers restrict it. Chrome always allows muted autoplay and allows sound only after the user has interacted with the site or has a history of watching media on it. Safari on iPhone and iPad allows muted inline autoplay, but not with sound. The practical rule is simple: autoplay muted, and let people turn sound on. Background: Chrome’s autoplay policy.

Autoplay a YouTube playlist

<iframe
  src="https://www.youtube.com/embed/videoseries?list=PLAYLIST_ID&autoplay=1&mute=1"
  title="YouTube playlist" allow="autoplay; encrypted-media" allowfullscreen></iframe>

The first video starts muted and the playlist continues automatically.

Autoplay inside a popup or modal

Don’t load the iframe until the popup opens — otherwise it plays hidden. Insert the iframe (or call playVideo() through the API) in the click handler that opens the popup. Because the click is a user gesture, many browsers even allow sound. Remove or pause the player when the popup closes.

Autoplay, speed and SEO

An autoplaying embed loads the YouTube player immediately, which adds weight to the page. Keep autoplay for above-the-fold hero moments, and lazy-load other embeds so they don’t compete with your main content. Search engines don’t reward autoplay itself — they reward pages people stay on.

Frequently asked questions

Related