YouTube Shorts Embed Code Generator

Turn any YouTube Shorts link into a free vertical 9:16 embed code. Copy it into your website and the Short plays right on your page. No sign-up needed.
The Short’s link from the Share button or the address bar, e.g. https://www.youtube.com/shorts/9HJrossmW1c
Want the whole Shorts channel as a gallery that updates itself?
Corner radius

Embed the video

<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>

  1. Click Copy code above to copy it.
  2. Open the page’s HTML file or template.
  3. Paste the code inside <body>, where the content should appear.
  4. 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 →

Before you go

Need more than one video? Show the whole Shorts channel as an interactive gallery that updates itself.

Create a Shorts gallery →
Or share this free tool:
Elfsight Video Gallery

Show all your Shorts, not just one

Video Gallery pulls your YouTube Shorts into a vertical carousel that keeps itself up to date — no new code for every Short.
  • 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

On a Short, YouTube’s Share → Copy link gives you a /shorts/ page link. Turning it into a working vertical player takes a few manual edits.
Feature
YouTube’s Share → Copy link
This generator
What you get
youtube.com/shorts/ID — a page link, not a player
An iframe with the /embed/ID player address
Vertical shape
Size the iframe yourself
9:16 box that scales with the page
Width on desktop
Set width and height by hand
One max-width field
Loop
Add loop=1 and playlist= with the same ID
On by default
Autoplay
Add autoplay=1 and start the video muted
One switch; starts muted
Privacy-enhanced mode
Change the domain to youtube-nocookie.com
One switch

What you get

YouTube’s Share → Copy link

youtube.com/shorts/ID — a page link, not a player

This generator

An iframe with the /embed/ID player address

Vertical shape

YouTube’s Share → Copy link

Size the iframe yourself

This generator

9:16 box that scales with the page

Width on desktop

YouTube’s Share → Copy link

Set width and height by hand

This generator

One max-width field

Loop

YouTube’s Share → Copy link

Add loop=1 and playlist= with the same ID

This generator

On by default

Autoplay

YouTube’s Share → Copy link

Add autoplay=1 and start the video muted

This generator

One switch; starts muted

Privacy-enhanced mode

YouTube’s Share → Copy link

Change the domain to youtube-nocookie.com

This generator

One switch

How to use the YouTube Shorts Embed Code generator

  1. Copy the Shorts link

    On YouTube, tap Share → Copy link on the Short you want to embed.

  2. Set the size

    Choose a max width. The player keeps the vertical 9:16 shape on every screen.

  3. Paste the code

    Copy the code and paste it into an HTML or embed block on your site.

Shorts embed options

Parameter
What it does
Example
/embed/VIDEO_ID
The player address. Use the ID after /shorts/ in the Short’s link.
https://www.youtube.com/embed/VIDEO_ID
9:16 container
A wrapper with a vertical aspect ratio, so the Short isn’t letterboxed.
aspect-ratio: 9 / 16
autoplay
Starts the Short when the player loads. Browsers usually allow this only when it’s muted.
autoplay=1
mute
Starts the player muted. Not listed in Google’s parameter documentation.
autoplay=1&mute=1
loop + playlist
Replays the Short. Needs playlist set to the same video ID.
loop=1&playlist=VIDEO_ID
controls
0 hides the player controls.
controls=0
playsinline
1 keeps the Short inside the page on iPhone and iPad instead of opening full screen.
playsinline=1
cc_load_policy
1 shows captions by default.
cc_load_policy=1
rel
0 limits the videos suggested at the end to the same channel. They can’t be turned off.
rel=0
youtube-nocookie.com
Privacy-enhanced mode: views don’t shape the viewer’s YouTube experience, and ads are non-personalized.
https://www.youtube-nocookie.com/embed/VIDEO_ID

/embed/VIDEO_ID

What it does

The player address. Use the ID after /shorts/ in the Short’s link.

Example

https://www.youtube.com/embed/VIDEO_ID

9:16 container

What it does

A wrapper with a vertical aspect ratio, so the Short isn’t letterboxed.

Example

aspect-ratio: 9 / 16

autoplay

What it does

Starts the Short when the player loads. Browsers usually allow this only when it’s muted.

Example

autoplay=1

mute

What it does

Starts the player muted. Not listed in Google’s parameter documentation.

Example

autoplay=1&mute=1

loop + playlist

What it does

Replays the Short. Needs playlist set to the same video ID.

Example

loop=1&playlist=VIDEO_ID

controls

What it does

0 hides the player controls.

Example

controls=0

playsinline

What it does

1 keeps the Short inside the page on iPhone and iPad instead of opening full screen.

Example

playsinline=1

cc_load_policy

What it does

1 shows captions by default.

Example

cc_load_policy=1

rel

What it does

0 limits the videos suggested at the end to the same channel. They can’t be turned off.

Example

rel=0

youtube-nocookie.com

What it does

Privacy-enhanced mode: views don’t shape the viewer’s YouTube experience, and ads are non-personalized.

Example

https://www.youtube-nocookie.com/embed/VIDEO_ID

Source: YouTube embedded players and player parameters

Embedded 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_ID

  • Player 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

Embed code
Video Gallery
Videos per embed
One video (or one playlist)
Unlimited videos in one widget
Stays up to date
Edit the code for every new video
New YouTube Shorts videos appear automatically
Mix sources
One platform per snippet
YouTube, Vimeo, TikTok, Instagram, Twitch and any video link
Layouts
Single player
Player with Gallery, Carousel, Grid, Masonry, Playlist
Responsive design
Needs a CSS wrapper
Built in
Coding
Copy and paste code for each video
No code — edit visually in the editor
Price
Free
Free plan, no credit card needed

Videos per embed

Embed code

One video (or one playlist)

Video Gallery

Unlimited videos in one widget

Stays up to date

Embed code

Edit the code for every new video

Video Gallery

New YouTube Shorts videos appear automatically

Mix sources

Embed code

One platform per snippet

Video Gallery

YouTube, Vimeo, TikTok, Instagram, Twitch and any video link

Layouts

Embed code

Single player

Video Gallery

Player with Gallery, Carousel, Grid, Masonry, Playlist

Responsive design

Embed code

Needs a CSS wrapper

Video Gallery

Built in

Coding

Embed code

Copy and paste code for each video

Video Gallery

No code — edit visually in the editor

Price

Embed code

Free

Video Gallery

Free plan, no credit card needed

Frequently asked questions

Official documentation

Chrome autoplay policy

Why autoplay needs the video to be muteddeveloper.chrome.com/blog/autoplayChrome autoplay policy

More free tools

Related guides

How to embed YouTube videos on website

Click Share → Embed on YouTube and paste the iframe, or generate a responsive code with options. To show a whole channel or playlist, use a YouTube feed widget.How to embed YouTube videos on website

How to embed a video on a website

Upload the video to YouTube or Vimeo and paste its embed code, use the HTML5 video tag for files you host yourself, or use a video gallery widget when you need several videos. Here’s how each method works and when to use it.How to embed a video on a website