Codectionary / Developer documentation / HTML

<audio>

The <audio> element embeds sound content — music, podcasts, or sound effects — directly in a page. Like <video>, it supports multiple <source> elements for format fallback and built-in playback controls, without needing Flash or other plugins.

Syntax

<audio src="song.mp3" controls></audio>

Examples

Basic Audio Player

An audio player with standard controls.

<audio controls>
  <source src="podcast.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

Multiple Format Fallback

Providing both MP3 and OGG formats for compatibility.

<audio controls>
  <source src="track.ogg" type="audio/ogg">
  <source src="track.mp3" type="audio/mpeg">
</audio>

Looping Sound Effect

A muted-by-default, loopable audio clip.

<audio id="notification" src="ding.mp3" preload="auto"></audio>
<button onclick="document.getElementById('notification').play()">Play Sound</button>

Attributes

  • controls (boolean): Shows the browser's built-in playback controls
  • autoplay (boolean): Starts playback automatically (subject to browser autoplay restrictions)
  • loop (boolean): Restarts playback automatically when it ends
  • preload (none | metadata | auto): Hints how much of the file to preload before playback

Best practices

  • Always show controls unless the audio is purely decorative (like a UI sound effect triggered by JavaScript)
  • Provide MP3 and OGG sources together for the widest browser compatibility
  • Be mindful of autoplay — most browsers block auto-playing audio with sound unless the user has interacted with the page
  • Use preload="none" for pages with many audio elements to avoid unnecessary bandwidth usage

Browser compatibility

Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.

Element support does not guarantee every audio codec or autoplay permission. These records describe the element and named attributes.

<audio>

Desktop

Chrome
Supported
From 3
Firefox
Supported
From 3.5
Safari
Supported
From 3.1
Edge
Supported
From 12
Opera
Supported
From 10.5

Mobile

Safari on iOS
Supported
From 3
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 3

Firefox

  • From 3.5 · For Firefox to play audio, the server must serve the file using the correct MIME type.

Safari

  • From 3.1

Edge

  • From 12

Opera

  • From 10.5

Safari on iOS

  • From 3

Chrome for Android

  • From 18

Firefox for Android

  • From 4 · For Firefox for Android to play audio, the server must serve the file using the correct MIME type.

Samsung Internet

  • From 1.0
<audio> controls

Desktop

Chrome
Supported
From 3
Firefox
Supported
From 3.5
Safari
Supported
From 3.1
Edge
Supported
From 12
Opera
Supported
From 10.5

Mobile

Safari on iOS
Supported
From 3
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature

Support history and limitations

Chrome

  • From 3

Firefox

  • From 3.5

Safari

  • From 3.1

Edge

  • From 12

Opera

  • From 10.5

Safari on iOS

  • From 3

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0
<audio> autoplay

Desktop

Chrome
Supported
From 3
Firefox
Supported
From 3.5
Safari
Supported
From 3.1
Edge
Supported
From 12
Opera
Supported
From 10.5

Mobile

Safari on iOS
Supported
From 10
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature

Support history and limitations

Chrome

  • From 3

Firefox

  • From 3.5

Safari

  • From 3.1

Edge

  • From 12

Opera

  • From 10.5

Safari on iOS

  • From 10

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0
<audio> loop

Desktop

Chrome
Supported
From 3
Firefox
Supported
From 11
Safari
Supported
From 3.1
Edge
Supported
From 12
Opera
Supported
From 10.5

Mobile

Safari on iOS
Supported
From 3
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 14
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature

Support history and limitations

Chrome

  • From 3

Firefox

  • From 11

Safari

  • From 3.1

Edge

  • From 12

Opera

  • From 10.5

Safari on iOS

  • From 3

Chrome for Android

  • From 18

Firefox for Android

  • From 14

Samsung Internet

  • From 1.0
<audio> preload

Desktop

Chrome
Supported
From 3
Firefox
Supported
From 4
Safari
Supported
From 3.1
Edge
Supported
From 12
Opera
Supported
From 15

Mobile

Safari on iOS
Supported
From 3
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature

Support history and limitations

Chrome

  • From 3 · Defaults to metadata in Chrome 64.

Firefox

  • From 4
  • From 3.5 · Removed in 4 · Last supported version: 3.6 · Alternative name: autobuffer

Safari

  • From 3.1

Edge

  • From 12

Opera

  • From 15 · Defaults to metadata in Opera 51.
  • From 10.5 · Removed in 15 · Last supported version: 12.1 · Alternative name: autobuffer

Safari on iOS

  • From 3

Chrome for Android

  • From 18 · Defaults to metadata in Chrome Android 64.

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0 · Defaults to metadata in Samsung Browser 9.0.
<source>

Desktop

Chrome
Supported
From 3
Firefox
Supported
From 3.5
Safari
Supported
From 3.1
Edge
Supported
From 12
Opera
Supported
From 15

Mobile

Safari on iOS
Supported
From 2
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 3

Firefox

  • From 3.5 · Until Firefox 15, Firefox picked the first source element that has a type matching the MIME-type of a supported media format; see bug 449363 for details.

Safari

  • From 3.1

Edge

  • From 12

Opera

  • From 15

Safari on iOS

  • From 2

Chrome for Android

  • From 18

Firefox for Android

  • From 4 · Until Firefox for Android 15, Firefox for Android picked the first source element that has a type matching the MIME-type of a supported media format; see bug 449363 for details.

Samsung Internet

  • From 1.0

MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.

HTML Living Standard

Specifications & further reading