New in HTML5.

<video> HTML Tag

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Element of
Every Way Possible To Embed Modern Media With HTML Code
What does <video> HTML Tag do?
The <video> element, which adds native video playback support to the HTML specification in HTML5, can be used to embed a video in an HTML document. Add the video URL to the element by using either the src attribute of the <video> element or by nesting one or more <source> elements between the opening and closing <video> tags.

Code Example

<video width="640" height="480" src="" controls>
  Sorry, your browser doesn't support HTML5 <code>video</code>, but you can
  download this video from the <a href="" target="_blank">Internet Archive</a>.

Adding Videos to Webpages

The video element was added in HTML5 along with it’s sibling, audio. You can learn more about both by reading our tutorial about using Media in HTML5. The video element is used to add a video to a webpage. The video is identified by adding a URL to a src attribute, and you can use it to embed videos hosted on your own hosting account or hosted by an external website.

iframe vs video

Lots of video hosting websites like YouTube and Vimeo provide a video embed code that uses an iframe rather than the video tag. What tag should you use when embedding a video from a video streaming service like YouTube or Vimeo? In nearly all cases, it will make the most sense to use the embed code provided by the video streaming service. By doing that you get the benefit of all of the optimization techniques built into the streaming service’s video player. Optimizations will help improve playback speed and will also include fallback options for users on older browsers.

Adam is a technical writer who specializes in developer documentation and tutorials.