← All articles

Embed a YouTube Playlist: Copy Code or Skip HTML

Embed a YouTube Playlist: Copy Code or Skip HTML

Geometric playlist cards beside an embedded frame

To embed a YouTube playlist, paste <iframe src="https://www.youtube.com/embed/videoseries?list=YOUR_PLAYLIST_ID"></iframe> into your page’s HTML or an embed block, then swap in your real playlist ID. Save the page and test it. The playlist has to be public or unlisted, and the videos inside it must allow embedding, or the player will show gaps or errors.


TL;DR:

  • Find the playlist ID after list= in its YouTube URL, stop at the next ampersand, then replace PLAYLIST_ID in the videoseries iframe.
  • A playlist must be public or unlisted, and every video must allow embedding; private videos or videos with age restrictions can trigger playback errors.
  • Autoplay often fails with sound because browsers block it, so add mute=1 when autoplay matters and let visitors start playback otherwise.
  • Lazy load the iframe so YouTube scripts wait until visitors scroll near it, particularly when several embeds could slow the page.
  • Use a direct iframe for a simple playlist, but choose a gallery widget when staff need visual edits or the layout requires custom branding.

Zyff
Add interactive features without complex code
Create and customize website widgets to engage visitors, then embed them on your site with a single line of code.

Table of Contents

Which embed formats work, and what does each part do?

YouTube supports multiple iframe URL forms. These URL forms load the playlist. YouTube’s embed guide documents the first one, and it is the one we reach for first:

<iframe width="560" height="315"
  src="https://www.youtube.com/embed/videoseries?list=PLAYLIST_ID"
  title="YouTube playlist"
  frameborder="0"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen></iframe>

The second form is the player URL with the playlist type spelled out:

<iframe width="560" height="315"
  src="https://www.youtube.com/embed?listType=playlist&list=PLAYLIST_ID"
  title="YouTube playlist"
  frameborder="0"
  allowfullscreen></iframe>

A few attributes do most of the work:

  • width and height set the player size in pixels. The 560 by 315 dimensions keep a widescreen shape.
  • allow lists the browser features the player may use, such as autoplay, encrypted media and picture-in-picture.
  • allowfullscreen adds the full-screen button. Leave it out and viewers lose it.
  • frameborder=“0” removes the default border around the frame.
  • title gives the frame a name that screen readers announce.

Common swaps include replacing fixed pixel sizes with width="[100%](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe)", or adding a class="playlist-embed" attribute so your stylesheet can target the frame.

How do you find your playlist ID?

The playlist ID is the string that follows list= in the playlist’s web address. It usually starts with “PL”, though other prefixes exist for special lists. Here is how to grab it:

  1. Open the playlist page on YouTube in your browser.
  2. Look at the address bar for ?list= or &list=.
  3. Copy everything after list= up to the next &, if there is one.
  4. Paste it in place of PLAYLIST_ID in either iframe above.
  5. Prefer a ready-made snippet? On desktop, open a video in the playlist, choose Share, then Embed, and copy the code YouTube generates.

ShortPoint’s embed walkthrough describes the same pattern: copy the ID from the URL and drop it into the standard iframe template.

Privacy matters here. A public or unlisted playlist can be embedded. For guidance on creating mobile-friendly content and mini sites that include embeds like these, see our Privacy Policy | Constants. A private playlist cannot, so viewers will see an error instead of videos.

How do you customize playback with URL parameters?

You change how the player behaves by adding parameters to the end of the src address. Start the first one with a question mark if the URL has none, and join later ones with an ampersand. For the videoseries form, the playlist ID already follows a ?, so append additional parameters with &. For example, you can add autoplay, looping, and caption parameters.

The official player parameters reference covers the full set. The ones readers ask about most:

  • autoplay=1 starts playback on load. Browsers often block autoplay with sound, so many visitors will still need to press play. Adding mute=1 makes autoplay more likely to work.
  • loop=1 repeats playback. For a single video, loop also needs a playlist parameter naming that same video. For a full playlist embed, loop applies to the whole list, so the list restarts after its last video.
  • cc_load_policy=1 turns captions on by default when a video has them.
  • start and end can trim playback to a selected time window for single videos.

When URL parameters are not enough, the IFrame Player API gives you programmatic control through JavaScript. Functions such as cuePlaylist, loadPlaylist, setLoop and setShuffle let you queue lists, shuffle them, or build your own buttons. It needs a bit of code and event listeners, so reach for it only when you need behavior a parameter cannot deliver.

What does privacy-enhanced mode do?

Privacy-enhanced mode swaps the embed domain from www.youtube.com to www.youtube-nocookie.com. Everything else in the iframe stays the same:

https://www.youtube-nocookie.com/embed/videoseries?list=PLAYLIST_ID

According to YouTube’s help page, this setting reduces cross-site personalization and applies to website embeds, not to mobile apps using WebViews. If you manage a school or office network, add the nocookie domain to your firewall allowlist, or the player may be blocked.

If your site is directed at children, YouTube expects you to self-designate it as child-directed using its tools. Some player features are limited for such content, so check YouTube’s current guidance before you publish.

Where do you paste the iframe on common site builders?

Every platform has a spot for raw HTML. Choosing the right block avoids most headaches:

  • WordPress: Add a Custom HTML block in the block editor, or edit the post in the code editor. The classic visual editor can strip iframe tags, so switch to the text view before saving.
  • Squarespace: Use a Code block with the display-source option off, or an Embed block. If the player looks cramped, wrap it in a responsive container (see the responsive section below). We also keep a guide to adding a widget to every Squarespace page.
  • Wix: Use the Embed Code element, choose HTML, and paste the iframe. Resize the element on the canvas so the frame fits. Our page on adding a widget to every Wix page covers site-wide placement.
  • SharePoint and ShortPoint: Paste the iframe into a Code Design Element or Code Web Part. As ShortPoint’s support article notes, you may need to enable sandbox or auto-resize settings for the frame to render.

What should you check when the embed fails?

Run through this list in order. It solves nearly every broken playlist embed:

  1. Check each video’s embedding setting. A playlist can be public while one video inside it blocks embedding, and that video fails to play in your embedded list.
  2. Look for private or age-restricted items. Private videos and age-restricted ones are the other usual causes of errors, so confirm every item is public and embeddable.
  3. Confirm playlist privacy. It must be public or unlisted, and its items must still be available.
  4. Open the browser console. Mixed-content warnings (an http:// source on an https:// page) or blocked domains point to the fix. Make sure youtube.com and youtube-nocookie.com are not blocked.
  5. Test parameters and autoplay rules. Remove extra parameters, reload, and add them back one by one. Browser autoplay policies can look like a broken embed when nothing is wrong with your code.

According to YouTube Help, private videos, disabled embedding and age restrictions are the usual causes when a playlist fails to appear.

That one line tells you where to look first: the videos, not the code.

How can you restyle the player beyond basic parameters?

YouTube’s player controls cannot be restyled with your own CSS, because they live inside the iframe. You can still shape the experience around the frame in several ways.

First, style the container. Give the iframe a border-radius, a box-shadow, or a colored border through your stylesheet, and set a max width so it sits well in your layout. These apply to the frame itself, not to what plays inside it.

Second, trim the player’s own chrome with parameters. Options such as modestbranding and rel reduce on-screen extras and limit related videos to the same channel, though YouTube controls the exact behavior and may change it. Check the parameter reference before relying on any of them.

Third, build your own controls with the IFrame Player API. You can hide the default control bar, then draw custom play, next and shuffle buttons that call playVideo, nextVideo and setShuffle. This takes real JavaScript, but it gives you full brand control over the interface around the video.

Fourth, skip the raw iframe and use a gallery or widget tool. A widget can present your playlist as a grid or carousel with your fonts and colors, then play videos in a lightbox. That swaps hand-written code for a visual builder. We cover our own option in the promo section below.

Whichever route you choose, keep the controls visible and keyboard-friendly. Heavy restyling that hides play buttons helps no one.

Four ways to restyle a playlist player

How do you make the playlist responsive?

A fixed-size frame can be awkward on small phones, so make the player scale with its container. The 560 by 315 dimensions are one example of a fixed size. The classic method is the aspect-ratio wrapper:

<div style="position:relative; padding-bottom:56.25%; height:0; overflow:hidden;">
  <iframe
    src="https://www.youtube.com/embed/videoseries?list=PLAYLIST_ID"
    title="YouTube playlist"
    style="position:absolute; top:0; left:0; width:100%; height:100%; border:0;"
    allowfullscreen></iframe>
</div>

The padding creates a widescreen shape. The wrapper holds that shape at any width, and the frame fills it.

Modern CSS gives you a shorter route. Support is broad in current browsers, though older ones may ignore it, so keep the wrapper method for legacy audiences.

A few more habits help:

  • Add max-width to the wrapper so the player does not stretch across huge monitors.
  • Remove fixed width and height attributes, or let your CSS override them.
  • Test at phone, tablet and desktop widths, in both portrait and landscape.
  • On builders like Wix, resize the embed element to its container instead of pinning it in pixels.

Playlists add one wrinkle: the video list that appears inside the player takes space on wide frames and collapses on narrow ones. Test your layout after resizing so the player still feels usable at small sizes.

Does embedding a playlist hurt SEO or page speed?

An iframe pulls in YouTube’s player scripts and related resources, which can slow a page, especially when several embeds sit above the fold. Slower pages can frustrate visitors and may weigh on performance metrics, so treat load cost as the main SEO concern.

Several habits keep the cost low:

  • Lazy-load the frame. Add loading="lazy" to the iframe so it loads only as the visitor scrolls near it.
  • Use a click-to-load facade. Show a static thumbnail with a play button, then swap in the real iframe on click. This avoids loading the player for people who never press play.
  • Limit embeds per page. One playlist player carries many videos, so you rarely need five frames on the same page.
  • Place it thoughtfully. Putting the player far above your key text can push content down on small screens.

On indexing, search engines may not treat the videos inside an iframe as part of your page’s own text. Do not count on the embed to carry your keywords. Write a useful intro, a short description of what the playlist covers, and descriptive headings around it. If a transcript or summary helps the reader, include it as real page text.

If you also want videos to be discoverable in search, consider adding video structured data where it fits, and make sure each video’s own YouTube title and description are well written. Keep claims modest: an embed supports your page, but your written content does the ranking work.

How do you keep an embedded playlist accessible?

An embed is only helpful if everyone can use it. Start with the basics we already put in the code samples.

  • Give the iframe a descriptive title. Screen readers announce it. “Playlist: beginner knitting lessons” beats “YouTube video player.”
  • Turn on captions where you can. Use cc_load_policy=1 so captions appear by default, and make sure the videos themselves carry accurate captions in YouTube Studio.
  • Keep keyboard access intact. Visitors should be able to tab to the player, press play, and tab past it. Do not wrap the frame in elements that trap focus.
  • Avoid forced autoplay. Sudden motion and sound disorient many people, including those using screen readers. Let visitors start playback.
  • Provide a text alternative. A short written summary or transcript near the player helps people who cannot watch or hear the video.
  • Mind color and contrast. If you add custom buttons or captions styling, check contrast against your background.
  • Allow enough size. A tiny player is hard to use on touch screens, so keep the controls large enough to tap.

Finally, test it yourself. Tab through the page, try a screen reader, and test the player on a phone. Hands-on testing can catch problems a checklist misses.

When should you embed directly and when should you use a widget?

Direct embeds are simple: an iframe, little setup, and no extra tools. If you just need a playlist on a page, stop there. But the moment you care about layout, brand fit, or letting a non-technical teammate update the page, the HTML approach starts to cost more than it saves. A gallery widget handles the grid, the sizing and the styling for you, and edits happen in a visual builder instead of a code block. Choose based on who maintains the page, not on which option sounds fancier.

— Ashok

Want a no-code way to show your playlist?

If you would rather skip the HTML, we built a free Video Gallery widget that embeds YouTube playlists with one line of code. You choose the layout, preview it, adjust the look to match your brand, and paste a single snippet into your site. It works on the same builders covered above.

Zyff

Open our Widget Builder to design your gallery, then check the pricing page to see what the Free plan and paid plans include, such as extra customization and removing our branding. Build your first gallery now and see how it looks on your page before you publish.

FAQ

How can I embed a YouTube playlist with a sidebar on my website?

Use the standard playlist iframe. When the frame is wide enough, YouTube shows the playlist’s video list beside or below the player automatically. If you want a custom sidebar, build it with the IFrame Player API, or use a gallery widget that lays out thumbnails next to the player.

Copy the playlist’s address from your browser, or use the Share button on the playlist page. The link contains list= followed by the playlist ID. Anyone can open it if the playlist is public or unlisted.

Can you put a playlist inside of a playlist on YouTube?

No, YouTube does not nest one playlist inside another. A playlist holds videos, not other playlists. To combine collections, add the videos from each list to a single new playlist, then embed that one.

How do I enable embedding on YouTube?

Open the video in YouTube Studio, go to its details, and turn on the option that allows embedding. Do this for each video in the playlist, since one blocked video can fail inside an embedded list. Playlist privacy must also be public or unlisted.

Sources