How to Display Video and Audio in HTML Without Plugins
How to play video and audio on a web page with the built-in HTML5 <video> and <audio> tags: no Flash, no plugins.
- Reading time
- 2 min read
- Comments
- Discussion

Adding Video
The basic structure looks like this:
<video controls width="640">
<source src="video.mp4" type="video/mp4" />
<source src="video.webm" type="video/webm" />
Your browser does not support the video tag.
</video><video>→ the main container<source>→ lets you provide different formats for better browser support- The text at the bottom appears only if the browser can’t play the video
Important Video Attributes
| Attribute | What it does |
|---|---|
| controls | Shows play, pause, volume, and fullscreen |
| autoplay | Starts playing automatically |
| muted | Starts with sound off (needed for autoplay in most browsers) |
| loop | Replays the video when it finishes |
| poster | Shows an image before the video plays |
| width | Sets the display width |
Example with more attributes:
<video controls autoplay muted loop poster="thumbnail.jpg" width="640">
<source src="video.mp4" type="video/mp4" />
<source src="video.webm" type="video/webm" />
Your browser does not support the video tag.
</video>Note: Most browsers block autoplay with sound, so you usually need to add muted if you want it to start automatically.
Adding Audio
The audio tag works in a similar way:
<audio controls>
<source src="audio.mp3" type="audio/mpeg" />
<source src="audio.ogg" type="audio/ogg" />
Your browser does not support the audio tag.
</audio>Common attributes for audio:
- controls → shows the player controls
- autoplay → starts playing automatically
- loop → repeats the audio
- muted → starts with sound off
Quick Tips
- Always include more than one
<source>format when possible (MP4 + WebM is a good combo). - Use controls so users can play and pause the media.
- Add a poster image for videos so the area doesn’t look empty before playing.
- Be careful with autoplay, many users find it annoying.
- Compress your video and audio files to keep the page loading fast.
With the <video> and <audio> tags, you can add media to your pages easily without relying on any external plugins.

Written by
Razak
Writes about the web, slowly, and builds small tools on the side.
Keep reading
Read next
1 minBest Practices for Writing Clean and Valid HTML
A collection of HTML best practices including proper indentation, naming, W3C validation, and common beginner mistakes you should avoid.
Read article
2 minGetting to Know HTML Iframe: How to Embed YouTube and Google Maps
How to use the HTML <iframe> tag to embed content from other sites, like a YouTube video or a Google Map, inside your own page.
Read article
1 minHow to Create Forms in HTML for Beginners
A beginner's guide to HTML forms: how the <form> tag sends data for logins, sign-ups and contact messages, starting from the basics.
Read article
Discussion
Comments
Loading comments…