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

Find a widget for you

You can use our widgets to accomplish practically any task on your website — increase users' confidence, grow conversion, engage your visitors, provide support, etc.

See All Widgets
GuideVideo Gallery

How to Autoplay Embedded YouTube Videos

Updated September 2026 · 22 min read

Short answer

Add ?autoplay=1&mute=1 to the YouTube embed URL. Browsers block autoplay with sound, so the mute parameter is what makes it work.

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

The no-code way

Show a YouTube channel or playlist in a gallery; the selected video plays in place.

Try Elfsight Video Gallery →

YouTube player parameters for autoplay and playback

ParameterValueWhat it does
autoplay1Starts the video automatically (muted in most browsers)
mute1Starts muted — required for reliable autoplay
loop1Loops the video; for a single video also set playlist=VIDEO_ID
playlistVIDEO_IDNeeded for loop on a single video
playsinline1Plays inline on iPhone instead of fullscreen
controls0 or 1Hides or shows the player controls
start / endsecondsStarts or stops at a given time
rel0Related 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

How do I autoplay a YouTube embed?

To autoplay a YouTube embed, add autoplay=1&mute=1 to the embed URL. Browsers only allow autoplay with sound off.

How do I make a YouTube embed autoplay?

Add autoplay=1&mute=1 to the embed URL.

Can YouTube autoplay with sound?

Not reliably — browsers block autoplay with sound.

How do I autoplay YouTube in WordPress?

Use a Custom HTML block with an iframe that includes autoplay=1&mute=1.

Does autoplay work on mobile?

Muted autoplay with playsinline=1 works in modern mobile browsers.

Can I loop a single YouTube video?

Yes: add loop=1&playlist=VIDEO_ID to the embed URL.

Why does my YouTube video autoplay on desktop but not on mobile?

It’s usually missing mute=1 or playsinline=1, or it’s inside a hidden element when the page loads.

Can I autoplay YouTube with sound?

Only after the visitor interacts with the page, for example when they click a button that opens the player.

Does autoplay work in the privacy-enhanced (youtube-nocookie.com) player?

Yes, the same parameters work.

How do I stop related videos at the end?

You can’t remove them completely; rel=0 limits them to the same channel. A gallery with “play next” keeps viewers on your own videos.

Related

Put your videos on your website

Create a free video gallery in minutes.

Create Widget for Free