CSS Portal

HTML <audio> Tag

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The <audio> tag is used to embed sound content into a web page, such as music, podcasts, voice recordings, or sound effects. It allows audio to be played directly in the browser without relying on third-party plugins or external media players, making it a modern and accessible solution for handling audio content on the web.

The <audio> element supports multiple audio formats, including MP3, WAV, and OGG. To improve browser compatibility, multiple <source> elements can be nested inside the <audio> tag. The browser will automatically select the first supported format, ensuring consistent playback across different devices and browsers.

Built-in controls can be displayed using the controls attribute, allowing users to play, pause, adjust volume, and seek through the audio track. Additional attributes such as autoplay, loop, muted, and preload give developers control over how and when the audio plays. For example, audio can be set to start automatically, repeat continuously, or load only when needed to improve page performance.

The <audio> element can also be styled using CSS and controlled programmatically with JavaScript, making it suitable for custom media players and interactive user experiences. It integrates well with accessibility tools and supports fallback text, which is displayed if the browser does not support the audio element.

Properties

Permitted Parents
Any element that accepts embedded content.
Content
<source>, <track> and text
Start/End Tags
Start tag: required, End tag: required

Example

<audio controls><source src="audio/chime.mp3" type="audio/mpeg">Sorry your browser does not support the audio tag.</audio>

Attributes

autoplay
Specifies that the audio will start playing as soon as it is ready.
controls
Specifies that audio controls should be displayed (such as a play/pause button, etc.).
loop
Specifies that the audio will start over again every time it is finished.
muted
Specifies that the audio output should be muted.
preload
Specifies if and how the author thinks the audio should be loaded when the page loads.
src
Specifies the location of the audio file. Its value must be the URI of an audio file.

Global Attributes

The <audio> tag also supports the Global Attributes in HTML5

Event Attributes

The <audio> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <audio> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!