YouTube Shorts Embed Code Generator
<div style="position:relative;border-radius:24px;overflow:hidden;width:100%;max-width:360px;margin:0 auto;aspect-ratio:9 / 16;"> <iframe style="position:absolute;inset:0;width:100%;height:100%;border:0;" src="https://www.youtube.com/embed/9HJrossmW1c?autoplay=1&mute=1&loop=1&playlist=9HJrossmW1c&playsinline=1" title="YouTube Shorts player" loading="lazy" allow="autoplay; encrypted-media; picture-in-picture; web-share" allowfullscreen></iframe> </div> <p style="margin:4px auto 0;max-width:360px;text-align:center;font:11px/1.4 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;color:#a3a7b0;">Created with <a href="https://elfsight.com/tools/youtube-shorts-embed-generator/" target="_blank" rel="noopener" style="color:inherit;text-decoration:none;">Elfsight</a></p>
- Click Copy code above to copy it.
- Open the page’s HTML file or template.
- Paste the code inside
<body>, where the content should appear. - Save and upload the page, then open it in a browser to check.
Need more than one video?
Show the whole Shorts channel as an interactive gallery that updates itself.
See Video Gallery for HTML →Show all your Shorts, not just one
Auto-updates when you publish new videos
Carousel, grid, masonry or player with playlist
YouTube, Vimeo, TikTok, Instagram, Twitch and any video link
No coding — works on any website
YouTube’s Share menu vs. this generator
/shorts/ page link. Turning it into a working vertical player takes a few manual edits.youtube.com/shorts/ID — a page link, not a player/embed/ID player addressloop=1 and playlist= with the same IDautoplay=1 and start the video mutedyoutube-nocookie.comWhat you get
YouTube’s Share → Copy link
youtube.com/shorts/ID — a page link, not a playerThis generator
/embed/ID player addressVertical shape
YouTube’s Share → Copy link
This generator
Width on desktop
YouTube’s Share → Copy link
This generator
Loop
YouTube’s Share → Copy link
loop=1 and playlist= with the same IDThis generator
Autoplay
YouTube’s Share → Copy link
autoplay=1 and start the video mutedThis generator
Privacy-enhanced mode
YouTube’s Share → Copy link
youtube-nocookie.comThis generator
How to use the YouTube Shorts Embed Code generator
Copy the Shorts link
On YouTube, tap Share → Copy link on the Short you want to embed.
Set the size
Choose a max width. The player keeps the vertical 9:16 shape on every screen.
Paste the code
Copy the code and paste it into an HTML or embed block on your site.
Shorts embed options
/embed/VIDEO_ID/shorts/ in the Short’s link.https://www.youtube.com/embed/VIDEO_ID9:16 containeraspect-ratio: 9 / 16autoplayautoplay=1muteautoplay=1&mute=1loop + playlistplaylist set to the same video ID.loop=1&playlist=VIDEO_IDcontrols0 hides the player controls.controls=0playsinline1 keeps the Short inside the page on iPhone and iPad instead of opening full screen.playsinline=1cc_load_policy1 shows captions by default.cc_load_policy=1rel0 limits the videos suggested at the end to the same channel. They can’t be turned off.rel=0youtube-nocookie.comhttps://www.youtube-nocookie.com/embed/VIDEO_ID/embed/VIDEO_ID
What it does
/shorts/ in the Short’s link.Example
https://www.youtube.com/embed/VIDEO_ID9:16 container
What it does
Example
aspect-ratio: 9 / 16autoplay
What it does
Example
autoplay=1mute
What it does
Example
autoplay=1&mute=1loop + playlist
What it does
playlist set to the same video ID.Example
loop=1&playlist=VIDEO_IDcontrols
What it does
0 hides the player controls.Example
controls=0playsinline
What it does
1 keeps the Short inside the page on iPhone and iPad instead of opening full screen.Example
playsinline=1cc_load_policy
What it does
1 shows captions by default.Example
cc_load_policy=1rel
What it does
0 limits the videos suggested at the end to the same channel. They can’t be turned off.Example
rel=0youtube-nocookie.com
What it does
Example
https://www.youtube-nocookie.com/embed/VIDEO_IDEmbedded Short not working? Common fixes
The iframe stays empty or says YouTube refused to connect
You pasted the /shorts/ link. YouTube pages can’t load inside another site’s iframe; only the player address youtube.com/embed/ID can.
The Short shows as a wide box with black bars
A plain iframe is usually sized like a wide video. Put the player in a 9:16 box, as the generator’s code does.
The Short fills the whole screen on desktop
Set a max width (for example 360 px). The height follows the 9:16 shape.
Autoplay doesn’t start
Browsers block autoplay with sound. Start muted and keep autoplay in the iframe’s allow attribute.
The Short plays once and stops
YouTube loops a single embedded video only when playlist= is set to the same video ID along with loop=1.
Error 153, or the video can’t be played on other websites
Error 153 means the page sent no HTTP Referer: remove referrerpolicy="no-referrer". If the owner turned off embedding, only they can turn it back on.
Why a Shorts link doesn’t embed as is
A link like youtube.com/shorts/VIDEO_ID opens the Shorts page on YouTube. It’s a full web page, not a player, and YouTube doesn’t let its pages load inside another site’s iframe. Paste it into an iframe or an embed block and you get an empty box or an error.
Shorts play in the same embedded player as regular YouTube videos. Keep the ID that comes after /shorts/ and put it into the player address:
Shorts link:
https://www.youtube.com/shorts/VIDEO_IDPlayer address:
https://www.youtube.com/embed/VIDEO_ID
The player itself doesn’t know the video is vertical, so it needs a 9:16 box around it, or the Short appears small with black bars at the sides. The generator does both: it rewrites the link and sets the shape.
All YouTube player parameters work the same way for Shorts.
Embed code vs. Elfsight Video Gallery
Videos per embed
Embed code
Video Gallery
Stays up to date
Embed code
Video Gallery
Mix sources
Embed code
Video Gallery
Layouts
Embed code
Video Gallery
Responsive design
Embed code
Video Gallery
Coding
Embed code
Video Gallery
Price
Embed code
Video Gallery