How To Autoplay Youtube Videos?


Sometimes you’ll want to autoplay Youtube videos, for example, if you have a video squeeze page (see mine here).

By default, Youtube videos do not autoplay. But the good news is that autoplaying Youtube videos is very easy. All  you need to do is add one line of code:


The hardest part is knowing how and where to add it, and that’s not hard! :)

New Youtube Embed Code (default)

To get the Youtube embed code, you simply go to the video you want to embed on your website and click on the ‘Embed’ button (located below the video). You’ll be shown some code that looks like this:

<iframe title=”YouTube video player” width=”640″ height=”390″ src=”″ frameborder=”0″ allowfullscreen></iframe>

Here’s where you can add the autoplay code:

<iframe title=”YouTube video player” width=”640″ height=”390″ src=”;autoplay=1” frameborder=”0″ allowfullscreen></iframe>

Old Youtube Embed Code

If you’re using the old Youtube embed code, the original code will look like this:

<object width=”640″ height=”390″><param name=”movie” value=”;hl=en_GB&amp;rel=0″></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”;hl=en_GB&amp;rel=0″  type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”640″ height=”390″></embed></object>

Here’s where you’ll need to add the Youtube autoplay code (2 places):

<object width=”640″ height=”390″><param name=”movie” value=”;hl=en_GB&amp;rel=0&amp;autoplay=1“></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”;hl=en_GB&amp;rel=0&amp;autoplay=1” type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”640″ height=”390″></embed></object>

If you’ve found this article helpful, please leave a comment below. Thanks!


{ 21 comments… add one }

  • Eddie May 2, 2011, 9:38 pm

    Do you know a line of code to add color to the play bar? They used to be able to come in all sorts of colors, blue, green, red, etc.

  • Melanie May 30, 2011, 12:16 am

    Hm doesn’t seem to work.

    • John Lagoudakis May 30, 2011, 1:02 am

      Hi Melanie, please send me a copy of your embed code and I’ll take a look at it. Use the Contact form here. Thanks.

  • Amber July 17, 2011, 7:18 am

    I can’t get it to work. Do you need my embed code?

  • Facundo August 3, 2011, 1:46 pm

    Perfect, exactly the little piece of code I was looking for. Thanks

  • Sabretooth Snaggle August 24, 2011, 10:13 am

    Works ‘like a boss’
    Will use this again as now you tube videos can autoplay its a whole new world. Nice one dude

  • bob November 10, 2011, 10:01 pm

    Thanks for this sir! worked like a charm! looks like this tutorials’ much updated compared to youtube’s API.
    bob´s last blog post ..When the old comes new… again.

  • Dave November 12, 2011, 12:04 am

    You might find this useful … created a script that allows you to select which Youtube embed parameters to include.



  • Shahriat Hossain January 3, 2012, 5:52 pm

    Nice to see that such a helpful site and contents – Thanks!

  • Hiba March 4, 2012, 2:34 am

    I’ve been having trouble embeding youtube players for the past 6 months…I used to be able to embed them just fine along with the autoplay thing but I don’t know why the embeding stopped working with either of the codes (old vs. new).
    I have a feeling that the new code might not work on the website I’m trying to embed videos on (the website is just because I don’t know whether the iframe thing works for them.
    But I know that youtube embeding does work because I’ve seen other people embed the videos on their viki profiles, and even on comments.
    I’ve had to resort to using but it doesn’t play all the videos I want.
    Anyway for now I’d just like help with embeding this playlist >

    PLEASE HELP!!!!!

  • Helmin Husakovic March 12, 2012, 2:51 am

    Thanks, it’s work!

  • Geoff June 16, 2012, 5:29 pm

    Thanks – done the job!

  • Nico January 15, 2013, 1:17 am

    John..Many thanks for the new youtube embed code business yes

  • Dario Petkovic February 25, 2013, 11:47 pm

    I still refer to this post to make my youtube videos to autoplay! Thanks John!

  • Lantana July 15, 2013, 3:35 pm

    Does anybody know how to change video volume on site? John, please, help) *I’m russian and english isn’t my native language.


Speak Your Mind…

CommentLuv badge