YouTube Embed Code Options – Autoplay On or Off

IMPORTANT UPDATE: There’s an update to this post. Although the codes on this post still apply to the old YouTube embed code, you can now use the newer YouTube embed codes which are HTML5 compatible and can be viewed on mobile Interent devices. You can view the latest update here: 2012 YouTube Embed Codes – Autoplay On and All Other Parameters

Here are some problems I face when embedding YouTube videos on my website.

First, the user has to click on the “play” button for the video to play. People who are new to online video might not even know to how to do that.

autoplay youtube

Second, at the end of the video, the “related videos” pop up taking your visitor to other sites. In other words, off your site!


So have you ever wanted your embedded YouTube video to automatically play (autoplay) when your page loads? How about turning off the “related video” feature at the end the video?

You’ve come to the right place. After much experimenting, here are all the YouTube embed code variations to get your video just the way you want it. Just replace the video URL with the video you want to embed:

Default YouTube Embed Code:
<object width=”425″ height=”355″><param name=”movie” value=”″></param><param name=”wmode” value=”transparent”></param><embed src=”″ type=”application/x-shockwave-flash” wmode=”transparent”width=”425″ height=”344″></embed></object>

Code to Autoplay a YouTube Movie:

<embed src=”″ type=”application/x-shockwave-flash” wmode=”transparent” width=”425″ height=”344″></embed>

Code to turn off RELATED MOVIES at the end of the movie
<embed src=”″ width=”425″ height=”344″ type=”application/x-shockwave-flash” wmode=”transparent”></embed>

Code to Autoplay YouTube Movie AND turn OFF related movies at the end of the movie:
<embed src=”″ type=”application/x-shockwave-flash” wmode=”transparent” width=”425″ height=”344″></embed>

Want to see what it looks like? Click on the image below to see a live example of the codes in action.

Picture 4
Click on this link to get the codes and view the live example.


What’s Next?

How about creating custom YouTube backgrounds to brand yourself? Check out the matching themes I use for my blog, Twitter, Facebook Fan Page and YouTube Channel at

If you enjoyed this post, please also subscribe to my RSS feed! You can also follow me on Twitter here.

90 thoughts on “YouTube Embed Code Options – Autoplay On or Off

  1. Bokca

    Wow bro, I was looking for this for ages and now I got it working! Thanks a bunch man! Really like this share! Keep up the great work!

  2. cathal butler

    Hi Brian, thanks for all your tips they are very helpful. I have one question, having used your instructions I was able to turn on the auto play and turn off the related videos at the end, however I was wondering if there was any way to get the still frame at the end of the video to match the opening frame …thanks

  3. Omar Lee

    Hi Brian, Great article here. I was wondering if is there anyway we can disable double click that goes to youtube site.

    Using the code below will not get you to youtube site when you double click it, it will just go fullscreen.

    But using the code below, will get you to youtube if you double click it. (new default embed code)

    The option i see with their difference was this: and

    and you cannot add the option autoplay=1&hl=en&fs=1&rel=0 to this option to become

    I just want to know how to add autoplay and turn off the related videos using this option

    or disable the double click command that goes to youtube site or just make it full screen instead of going to youtube site. to become

    I wonder if there is an option like that. Sorry for my long comments. Just make sure my point is surely understood.


  4. Omar Lee

    Using the code below will not get you to youtube site when you double click it, it will just go fullscreen. (new default embed code)

    But using the code below, will get you to youtube if you double click it.

  5. Omar Lee

    i thought i forgot to paste the code, but i just knew the code was disabled by wordpress

    Sorry. my comment looks spam..coz it has become many comments.

  6. Pingback: Videos from YouTube added to your Blog Easily. | Linux Admins

  7. Burhan

    this old code doesnt work anymore. Actually, you will have to use the “?” instead of “&” for your first parameter only. If you use more than one parameter, you will then have to add “&” to the chain.

    for any problem, just email me at

  8. Rudy

    Since youtube has updated there embed code to an iframe now I was searching online to see how to make a playlist I made for my site to auto play when the page loads. Youtube doesn’t offer to much in the way of embedding options now. I came across this site when I was trying to figure out how to get it to auto play but this post has the old embed codes so I thought I would share how to get your videos or playlist to auto play since even on the youtube help section which was updated feb 2, 2011 I believe is not up to date with the new iframe code.

    Eample of current iframe code (playlist):

    After playing around with the “play in HD” check box option I notice a small bit of extra coded added to the end of the URL which was ” &hd=1 ” So I figured if I changed the [ &hd=1 ] to [ &autoplay=1 ] at the end of the URL it would make the video start by its self once the web page loaded which it did work :)

    Example of current iframe code with auto play:

    I have a live example of this on my website in the side bar of the site. Just click on my name to the left if you want to see how the video auto plays now. Also you can change the size of the video right in the script if the size options don’t work for you on youtube as they didn’t for me. Hope this helps anyone with the same problem I had cause I never did find the answer after search for over an hour online for such a simple option. :)

  9. Rudy

    Just thought since this post talks about how to make the old embed code loop I figured I would put the iframe code to make it loop as well.

    Example with auto starting and looping:

    added &autoplay=1&loop=1 at the end of the youtube URL

    code [ ]

  10. Vincent Kernaghan

    I spent hours trying different things until I found this page which helped me figure it out in 5 minutes. With the latest changes from YouTube, this is the code that works for me on both IE and Firefox. It gets inserted immediately after the URL, before the closing ”


    Like Burhan points out earlier above, it now needs to start with the ? and use the & repeatedly. I did it with no spaces between the parameters.

    The full code looks like this:

    Thank you, thank you, thank you!

  11. OhGreat

    Auto playing videos on your website is the fastest way to make people leave. Please don’t encourage autoplaying, it’s annoying as hell…

  12. L. Holland


    I just wanted to thank you very very much for these codes. The autoplay code worked like magic. I truly appreciate your assistance! Have a great day :-)

    -L. Holland

  13. Alex

    I tried to add the autoplay code like this:

    Original code:

    New code:

    But this rendered the video unplayable. It just was a black box in the page.
    I also tried to add the code: &rel=0 either together and seperately to the iframe code with the same results.

    Can you give me a hint as to why this does not work for me?
    The framework my site is in is Magento go ecommerce – if this helps at all.
    thanx very much in advance for your help

  14. Jimmy Shine

    I have two youtube auto play videos on my site 1 in the Solavei menu and one in the Blog menu. They work fine for computers but do not auto play for smart phones. Is there a way to make them auto play for phones like they do for computers. Most people will not click the start button to play the video.

    Thanks Respectfully,

    Jimmy Shine

  15. Herman

    Hi Brian and Hi everyone. I need your help. I need to embed videos on my website for members in a protected area. I know that does this but I have to pay for it. Is it possible to do it with Youtube.

  16. Brian Wong Post author

    You can try setting the privacy of your youtube video to “unlisted”. For videos in membership sites, I prefer to host them on Amazon S3 to secure them and it only costs a few cents each month to maintain.

Leave a Reply

Your email address will not be published. Required fields are marked *