Free tool

YouTube Embed Code Generator

Paste a link to a YouTube video, Short or playlist and get the code to put it on your website. Free, no sign-up.

Your embed code

Your embed code shows here.

This is a channel link. An embed code shows one video or playlist. To show your latest videos on your website, use a YouTube widget.

Start your free trial

Paste a link to a YouTube video, Short or playlist first.

This is not a YouTube video, Shorts or playlist link. Example: https://www.youtube.com/watch?v=abc123XYZ_0

Paste the code where your website builder accepts HTML. With Fit the width of the page, the video fills its column and keeps its shape. Your browser did not let us copy. Tap and hold in the code box, choose Select All, then Copy. Your browser did not let us copy. Click in the code box, then press Ctrl+A and Ctrl+C (Cmd+A and Cmd+C on a Mac).

Paste a link to see the video here. If the player shows an error, the owner turned off embedding, or the video is private, age-restricted or deleted.

Want your latest videos, updated automatically?

An embed code shows one video. A SnapWidget YouTube widget shows your latest videos in a grid or board and adds new uploads by itself.

Start your free trial

How do I embed a YouTube video on my website?

Copy the video's link, paste it into the tool above and copy the embed code. Then paste the code into an HTML or code block on your website and publish the page.

  1. On YouTube, open the video, Short or playlist and copy its link from the address bar.
  2. Paste the link above, choose the options you want, and click Get embed code.
  3. Click Copy code and paste it into your website where it accepts HTML.

Can I get the embed code from YouTube itself?

Yes. On a computer, open the video, click Share and choose Embed, then copy the code. This tool makes the code from the link alone and adds options such as autoplay, loop and a player that fits the width of your page.

How do I make an embedded YouTube video responsive?

Turn on Fit the width of the page. The code then sets the player to the full width of its column, and the CSS aspect-ratio property keeps the 16:9 shape (9:16 for Shorts) on every screen.

How do I make an embedded YouTube video autoplay?

Turn on Autoplay. The tool adds autoplay=1 and mute=1 to the code, because most browsers block autoplay with sound. YouTube does not count autoplayed embeds as views.

What is privacy-enhanced mode?

It loads the player from youtube-nocookie.com instead of youtube.com. YouTube says that views of the embedded video then do not personalize the viewer's YouTube experience.

Why does my embedded YouTube video show an error?

The owner turned off embedding, or the video is private, age-restricted or deleted. Error 153 means that your page did not send YouTube a referrer: keep referrerpolicy="strict-origin-when-cross-origin" in the code.

What is the difference between an embed code and a YouTube widget?

An embed code shows one video or playlist that you choose. A YouTube widget shows your channel's latest videos in a grid or board and adds new uploads by itself. It needs a paid plan from $8 a month, with a 14-day free trial.

Does the embed code work on WordPress, Squarespace and Shopify?

Yes, in any place that accepts HTML with a script. Paste it where our guides paste the SnapWidget code: a Custom HTML block in WordPress, a Code Snippet in a Squarespace Embed block, or a Custom Liquid section in Shopify.

Frequently asked questions

Yes. It is free and needs no sign-up or YouTube login. Your browser builds the code, and the preview plays the video from YouTube.

Yes. Paste the Shorts link, for example https://www.youtube.com/shorts/abc123XYZ_0. The tool makes a tall 9:16 player for it.

Yes. Paste the playlist link (it has list= in it). The player plays the videos of the playlist in order.

Enter the time in Start at, for example 1:30. If your link has a time in it, such as ?t=90, the tool fills in Start at for you.

An embed code shows one video or playlist. A SnapWidget YouTube widget shows your latest uploads in a grid or board and adds new ones by itself. It needs a paid plan from $8 a month, with a 14-day free trial.

Show your latest YouTube videos, not one video