- HTML Tag
- Audio Format and Browser Support
- Tips and Notes
- Browser Support
- Attributes
- Global Attributes
- Event Attributes
- Related Pages
- Default CSS Settings
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
- HTML Audio
- The HTML Element
- Example
- HTML Audio — How It Works
- HTML Autoplay
- Example
- Example
- Browser Support
- HTML Audio Formats
- HTML Audio — Media Types
- HTML Audio — Methods, Properties, and Events
- HTML Audio Tags
HTML Tag
The tag is used to embed sound content in a document, such as music or other audio streams.
The text between the tags will only be displayed in browsers that do not support the
There are three supported audio formats in HTML: MP3, WAV, and OGG.
Audio Format and Browser Support
Browser | MP3 | WAV | OGG |
---|---|---|---|
Edge / IE | YES | YES* | YES* |
Chrome | YES | YES | YES |
Firefox | YES | YES | YES |
Safari | YES | YES | NO |
Opera | YES | YES | YES |
Tips and Notes
Tip: For video files, look at the tag.
Browser Support
The numbers in the table specify the first browser version that fully supports the element.
Element | |||||
---|---|---|---|---|---|
4.0 | 9.0 | 3.5 | 4.0 | 11.5 |
Attributes
Attribute | Value | Description |
---|---|---|
autoplay | autoplay | Specifies that the audio will start playing as soon as it is ready |
controls | controls | Specifies that audio controls should be displayed (such as a play/pause button etc) |
loop | loop | Specifies that the audio will start over again, every time it is finished |
muted | muted | Specifies that the audio output should be muted |
preload | auto metadata none | Specifies if and how the author thinks the audio should be loaded when the page loads |
src | URL | Specifies the URL of the audio file |
Global Attributes
Event Attributes
Related Pages
Default CSS Settings
COLOR PICKER
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Get Certified
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
HTML Audio
The HTML element is used to play an audio file on a web page.
The HTML Element
To play an audio file in HTML, use the element:
Example
HTML Audio — How It Works
The controls attribute adds audio controls, like play, pause, and volume.
The element allows you to specify alternative audio files which the browser may choose from. The browser will use the first recognized format.
The text between the tags will only be displayed in browsers that do not support the
HTML Autoplay
To start an audio file automatically, use the autoplay attribute:
Example
Note: Chromium browsers do not allow autoplay in most cases. However, muted autoplay is always allowed.
Add muted after autoplay to let your audio file start playing automatically (but muted):
Example
Browser Support
The numbers in the table specify the first browser version that fully supports the element.
Element | |||||
---|---|---|---|---|---|
4.0 | 9.0 | 3.5 | 4.0 | 10.5 |
HTML Audio Formats
There are three supported audio formats: MP3, WAV, and OGG. The browser support for the different formats is:
Browser | MP3 | WAV | OGG |
---|---|---|---|
Edge/IE | YES | YES* | YES* |
Chrome | YES | YES | YES |
Firefox | YES | YES | YES |
Safari | YES | YES | NO |
Opera | YES | YES | YES |
HTML Audio — Media Types
HTML Audio — Methods, Properties, and Events
The HTML DOM defines methods, properties, and events for the element.
This allows you to load, play, and pause audios, as well as set duration and volume.
There are also DOM events that can notify you when an audio begins to play, is paused, etc.
For a full DOM reference, go to our HTML Audio/Video DOM Reference.
HTML Audio Tags
Tag | Description |
---|---|
Defines sound content | |
Defines multiple media resources for media elements, such as and |