Welcome to HTML5-Tutorials

Our site offers a lot of HTML5 learning from absolutely beginning to advanced level.If you want to make a website with HTML,this site will completely guide you a lot.So learn HTML5 syntax and form of coding easily with this website.If you have any doubt,leave a message on us.We will return you so soon.This site includes innumerable number of references you need to do after studying their corresponding elements.

In this page,we will learn about HTML <audio> tag.

What is <audio> tag?

The <audio> tag defines the sound or audio files.

Type:Inline Element

Example of <audio>


Three audio file formats( .mp3, .wav, .ogg)

Upto now, three audio file formats( .mp3, .wav, .ogg) are supported in HTML5

File Format
.mp3 Yes Yes Yes Yes Yes
.wav Yes No Yes Yes Yes
.ogg Yes No Yes No Yes

MIME Types for Audio Formats

Audio File Format MIME-type
.mp3 audio/mpeg
.wav audio/wav
.ogg audio/ogg

Supported Browsers.

<audio> 4.0 or higher 9.0 or higher 3.5 or higher 4.0 or higher 10.5 or higher

Full Code Example

<!DOCTYPE html>
<audio controls>
<source src="swamp.mp3" type="audio/mpeg">
<audio controls>
<source src="ghost.mp3" type="audio/mpeg">


The control attribute includes Pause, Play button and Volume Stabilizer.
Since the control element is inline Elements, their is no line break before and after the <controls> element so that the above two sources are displayed in the same row.

Attributes of <audio> tag

Attribute Value Notes
autoplay autoplay It defines the audio playback should start automatically just after the page loading.
controls control It defines the control button(like play, pause button) of an audio playback
loop loop It defines the audio playback should repeat automatically and infinitely.
muted muted It defines the audio playback should not produce sound like at 0 Volume.
preload auto
It defines that audio playback should play or not with the refreshing of page according to its value.
src URL It defines the URL(or simple Location) of the audio file.
volume volume It sets the initial volume of the audio file in the range of 0.0-1.0.

More Reference

Note that <audio> element could not work if no attribute is used. The <audio> element is new in HTML5 but not supported in HTML4.01.Even though it was supported in HTML5, it was hardly used since we cannot make the style what we want.

To define your HTML Document is Version5, be sure to add <DOCTYPE html>.