Your browser does not support the audio element."> Your browser does not support the audio element." />
Easy Tutorial
❮ Tag Q Att Tr Align ❯

HTML <audio> Tag

Example

Play sound:

&lt;audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

Browser Support

The numbers in the table specify the first browser version that supports the tag.

Element
<audio> 4.0 9.0 3.5 4.0 10.5

Tag Definition and Usage

The <audio> tag defines sound, such as music or other audio streams.

Currently, the <audio> element supports three file formats: MP3, WAV, Ogg.

Browser MP3 WAV Ogg
Internet Explorer YES NO NO
Chrome YES YES YES
Firefox YES YES YES
Safari YES YES NO
Opera YES YES YES

Differences Between HTML 4.01 and HTML5

The <audio> tag is new in HTML5.


Tips and Notes

Tip: You can place text between the <audio> and </audio> tags. This text will be displayed in browsers that do not support the <audio> tag.


Attributes

Attribute Value Description
autoplay New autoplay If present, the audio will start playing as soon as it is ready.
controls New controls If present, it displays audio controls to the user (such as play/pause button).
loop New loop If present, the audio will restart playing every time it ends.
muted New muted If present, the audio output will be muted.
preload New auto <br>metadata <br>none Specifies if and how the author thinks the audio should be loaded when the page loads.
src New URL Specifies the URL of the audio file.

Global Attributes

The <audio> tag supports HTML's global attributes.


Event Attributes

The <audio> tag supports HTML's event attributes.

❮ Tag Q Att Tr Align ❯