How to Autoplay Embedded YouTube Videos on Your Page?

YouTube makes it easy to embed videos on your website. By modifying the video’s parameters, you can control a variety of the embedded video’s settings, including enabling the autoplay feature to have the video start playing automatically as soon as a user lands on the page.

YouTube Embed Video
YouTube Embed Video

This guide will walk you through the process of setting a YouTube video to autoplay when it is embedded on a website. Importantly, using the autoplay feature for embedded videos does not contribute to the video’s view count.

  1. Visit the YouTube video you want to embed on your site.
  2. Below the video, click on the Share button.
    Opening YouTube Video Share Dialog Box
    Opening the YouTube Video Share Dialog Box
  3. Select the Embed feature.
    Navigating to Embed
    Navigating to Embed
  4. Copy the provided HTML code and paste it into your website’s code editor.
  5. Add the autoplay parameter to the src attribute in the video embed code.
  6. Locate the video ID within the code, and append the ?autoplay=1 parameter following it.
  7. Here is a comparison example for clarity:
    Before: 
    
    <iframe
      width="560"
      height="315"
      src="https://www.youtube.com/embed/BNuGMErEEIY"
      title="YouTube video player"
      frameborder="0"
      allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
      allowfullscreen
    ></iframe>
    
    After:
    
    <iframe
      width="560"
      height="315"
      src="https://www.youtube.com/embed/BNuGMErEEIY?autoplay=1"
      title="YouTube video player"
      frameborder="0"
      allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
      allowfullscreen
    ></iframe>
    
  8. If the embed code already includes a URL parameter—indicated by the ? symbol immediately following the video ID—you should use the & sign to append additional parameters. For example:
    Before: 
    
    <iframe
      width="560"
      height="315"
      src="https://www.youtube.com/embed/BNuGMErEEIY?si=vDPs7OZntRcR3XVs"
      title="YouTube video player"
      frameborder="0"
      allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
      allowfullscreen
    ></iframe>
    
    After: 
    
    <iframe
      width="560"
      height="315"
      src="https://www.youtube.com/embed/BNuGMErEEIY?si=vDPs7OZntRcR3XVs&autoplay=1"
      title="YouTube video player"
      frameborder="0"
      allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
      allowfullscreen
    ></iframe>

With this simple adjustment, you have the ability to decide if an embedded video should start playing automatically.

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.

Comments

14
    SA
    sapan Dec 15, 2018

    Thnks

    PY
    Prosper Yole Mar 6, 2019

    Thanks

    AM
    Abdulah Mohamed May 3, 2019

    OK maybe I am stupid, I added the code from above, but NOTING happens…..just blank screen. I added the code in te HEAD of the HTML code.

    Help please

      SW
      Shane Warren Author Sep 13, 2019

      It needs to be added to the HTML code as indicated in the example provided in the article

      pɑpɑɛɱɛʀituร Jul 20, 2020

      ?autoplay=1&mute=1

    SG
    Simon Sutton George Aug 2, 2019

    Thanks

    AE
    Aiyegbeni Adebayo Evanson Sep 18, 2019

    I added this to my blogger site and still no autoplay coming up.And i also tried this as well….Autoplay not coming up.

      JS
      Jeannette Sandaine Nov 20, 2020

      Ok I had this problem and quite frankly I was getting PISSED!!! Ha Ha … so here is what finally WORKED! it IS NOT ?autoplay=1 ….. REPLACE the? with & so it would be &autoplay=1 right after the playlist numberex:

      Reply
    SW
    Shane Warren Author Sep 19, 2019

    Try this

    CS
    Claudio Soprano Dec 1, 2019

    autoplay=1 does not make it do the autoplay.

      pɑpɑɛɱɛʀituร Jul 20, 2020

      ?autoplay=1&mute=1 is what you need to embed. You will have to unmute when it starts playing unfortunately. Trying to set mute to 0 value will not let the video auto start, so keep it to 0. I know, almost pointless, but there are people working on the mute coding to see if there is a work around

      Reply
    MZ
    Muhammad Zubyan Author Apr 22, 2021

    That’s Great!! Which comment helped you?

    PG
    PG Oct 25, 2021

    Finally.. this worked. all i needed was mute=1. Thank you so much!

    JS
    June Song Aug 30, 2022

    It worked! Thanks!