You are here: >

HTML <audio> tag

HTML audio tagWhen writing in HTML, the <audio> tag is an inline element used to embed sound files into a web page. It is useful when you want to add any audio, such as a song or interview, to your web pages. The following sections contain information about this tag, including an example of it in use, as well as related attributes and browser compatibility.

Example code

<audio controls="controls">  
Your browser does not support the &lt;audio&gt; tag. <source src="../m/example.mp3" />

Example result

File formats and browser support

When utilizing the <audio> tag, you need to ensure that your sound file is in the proper format. There are three accepted formats which include MP3, Ogg, and Wav. The table below shows which Internet browsers support which file format.

Browser MP3 Ogg Wav
Chrome Yes Yes Yes
Internet Explorer Yes No No
Firefox Yes Yes Yes
Safari Yes No Yes
Opera Yes Yes Yes


Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <audio> tag, as well as a description of each.

Attribute Description
autoplay Designates that the audio file will play immediately after it loads
controls Designates what controls to display with the audio player
loop Designates that the audio file should continuously repeat
muted Designates that the audio file should be muted
preload Designates how and when the audio file should load
src Designates the URL of the audio file


Internet Explorer Firefox Safari Opera Chrome
9.0+ 3.5+ 4.0+ 10.5+ 4.0+

Also see: Browser, Compatibility, Loop, Mute, Web page