Try every tool free for 14 days with 250 credits. No card needed. Start free
Product
AI video generatorText or an image to video with Veo, Kling, Seedance and more AI avatars & lip syncTalking presenters and lip-synced video from a script or audio UGC video adsAn AI creator presents your product on camera, in 9:16 Subtitles & translationTranscribe, edit, translate and download SRT or VTT Podcast to clipsTurn a long video into captioned vertical clips AI dubbingDub a video into 32 languages, in the speaker's own voice AI voice & cloningNatural voiceovers and your own cloned voice
Company
Free tools Pricing Blog Contact

How to Embed a Video on a Website (YouTube or MP4)

Three ways to put a video on your site: embed it from YouTube, paste a link into WordPress, or host the MP4 yourself with the video tag. Responsive sizing, autoplay, start times and speed.

How to Embed a Video on a Website (YouTube or MP4)

To embed a video on a website, either embed it from a video host or host the file yourself. From YouTube, click Share under the video, then Embed, copy the iframe code and paste it into your page's HTML. In WordPress, paste the YouTube or Vimeo link into an Embed block. To host it yourself, upload an MP4 (H.264, AAC) and add an HTML5 video tag with controls.

More on this topic: Video specs by platform, every guide in one place.

Below are the steps for each, how to make the player responsive, start at a set time or autoplay, and which option loads faster.

The short answer

YouTube: Share > Embed > copy the code > paste it into an HTML block. WordPress: paste the video URL into an Embed (or YouTube/Vimeo) block. Your own file: upload the MP4 and use <video controls playsinline poster="cover.jpg"><source src="video.mp4" type="video/mp4"></video>. For autoplay, browsers require the video to be muted.

Key takeaways

  • Embedding from YouTube or Vimeo saves your bandwidth and handles quality switching.
  • Self-hosting gives you full control and no third-party branding, but you pay for the bandwidth and need a small, web-ready MP4.
  • Autoplay only works muted in modern browsers.
  • YouTube's privacy-enhanced mode uses the youtube-nocookie.com domain.
  • Only public and unlisted YouTube videos can be embedded; private ones can't.

How to embed a YouTube video

  1. On a computer, open the video on YouTube.
  2. Click Share below the video, then Embed.
  3. Copy the HTML code from the box.
  4. Paste it into your website's HTML (in most site builders, an HTML or Code block).

YouTube's help page also lists options you can add to the embed URL:

OptionHowNote
Start at a time?start=90 (seconds)Starts at 1:30
Autoplayautoplay=1 (and mute=1)YouTube says autoplayed embeds don't count as views
Captions oncc_load_policy=1cc_lang_pref=fr sets the language
Privacy-enhanced modeUse youtube-nocookie.com in the URLNetwork admins must allow that domain too

QuickVeed's free YouTube embed code generator builds the code for you: paste a link, set a start or end time, tick autoplay, loop, captions or privacy-enhanced mode, and copy a responsive 16:9 or fixed-size embed.

How to embed a video in WordPress

WordPress's documentation says the block editor can embed content from services such as YouTube, Vimeo, TED and TikTok: add an Embed block (or the YouTube or Vimeo block) and paste the video's URL. You don't upload anything; the block links to the video. WordPress notes that only public and unlisted YouTube videos can be embedded, and that Facebook and Instagram embeds need a developer app and token since 2020.

Other site builders (Squarespace, Wix, Webflow, Shopify) have a video or embed block that takes a URL or code; look for “Video” or “Embed” in the block list.

How to embed your own MP4 with HTML

If you host the file yourself, use the HTML5 video element:

UseCode
Standard player<video controls playsinline preload="metadata" poster="cover.jpg"><source src="video.mp4" type="video/mp4"></video>
Silent looping background<video autoplay muted loop playsinline poster="cover.jpg"><source src="bg.mp4" type="video/mp4"></video>
  • controls shows play, volume and seek; poster is the image shown before playback; playsinline keeps it in the page on phones.
  • MDN notes that modern browsers block autoplay with sound, so add muted if you use autoplay; also, boolean attributes like autoplay="false" still switch autoplay on, so remove the attribute instead.
  • preload="metadata" avoids downloading the whole video before someone presses play.

Make the file web-ready: MP4 with H.264 and AAC (see MP4 vs MOV), sized for the page, and with the index at the start (FFmpeg's -movflags +faststart). A background loop should be a few MB at most; the free video compressor shrinks it, and how to compress a video covers desktop tools. For the poster, grab a sharp still with the free frame grabber (see how to get a still image from a video).

Make the embed responsive

A fixed-size iframe (560×315) overflows on phones. Wrap it so it scales:

ApproachCode
Modern CSSiframe { width: 100%; aspect-ratio: 16 / 9; height: auto; }
Self-hosted videovideo { width: 100%; height: auto; }

For a vertical Short or Reel, use aspect-ratio: 9 / 16 and cap the width so it doesn't fill a desktop screen.

YouTube embed or self-hosted: which to choose

YouTube or Vimeo embedSelf-hosted MP4
Bandwidth costThe host'sYours
Quality switching on slow connectionsAutomaticOne file unless you set up streaming
Branding and suggestionsThe host's player and brandingNone; your design
Page speedThe player loads extra scripts; load on click to helpLight if the file is small and preload is metadata
Best forLong videos, tutorials, anything over a minuteShort loops, hero backgrounds, product clips

A good thumbnail decides whether people click play: how to make a YouTube thumbnail applies to embedded videos too. For a tiny silent animation, a short muted MP4 is usually smaller than a GIF; see how to convert a video to GIF.

Frequently asked questions

How much video can I embed from a free Vimeo account?

Vimeo's Free plan allows 3 GB of embeddable and non-public videos (public, non-embeddable uploads are unlimited). Paid plans include 2 to 7 TB of total storage. See Vimeo upload limits.

How do I embed a YouTube video on my website?

Click Share under the video, then Embed, copy the code and paste it into an HTML block on your page.

How do I embed a video in WordPress?

Add an Embed (or YouTube/Vimeo) block and paste the video's URL. Only public and unlisted YouTube videos can be embedded.

How do I embed an MP4 on a website?

Upload the MP4 and use the HTML video tag with controls, playsinline and a poster image.

Why won't my embedded video autoplay?

Browsers block autoplay with sound. Add muted (or mute=1 for YouTube) and it will autoplay.

How do I make a YouTube embed start at a certain time?

Add ?start= followed by the seconds to the embed URL, e.g. ?start=90 for 1:30.

Do I need schema markup for an embedded video?

If you want the video to appear in Google's video results, give it its own watch page and add VideoObject structured data (name, thumbnailUrl and uploadDate are required) or a video sitemap. Google doesn't treat a blog post with a supporting embed as a watch page. Video SEO walks through it.

Does embedding a YouTube video slow down my site?

The player adds scripts. Loading it only when the visitor clicks, or using a thumbnail first, keeps pages fast.

Try it with your own video

Add captions to the video before you embed it, so visitors can follow with the sound off. Upload the video, pick a caption style, and judge the result for yourself. QuickVeed plans start at $18/month, and new accounts get a 14-day trial with 250 credits, no card needed. Sign up or see pricing.

Sources

Competitor details in this post were checked against these public pages in October 2026. Products and prices change, so confirm with each vendor before you decide.

Share this article
Ijharul Islam
Written by

Founder, QuickVeed

Ijharul Islam is the founder of QuickVeed, the AI video studio for business. He writes hands-on comparisons and guides on AI video generation, presenters, UGC-style ads and subtitles, so marketing and sales teams can publish more video without a production crew.

Chat with the founder