This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.



The audio element (<audio>) is used for playing audio files and may display a minimal media player user interface.

Overview Table

DOM Interface

Extensive documentation on manipulating the element may be found on the HTMLAudioElement page.

HTML Attributes

  • autoplay = “autoplay” or “” (empty string) or empty
    Instructs the UA to automatically begin playback of the audio stream as soon as it can do so without stopping.
  • preload = “none” or “metadata” or “auto” or “” (empty string) or empty
    Represents a hint to the UA about whether optimistic downloading of the audio stream itself or its metadata is considered worthwhile.
    • "none": Hints to the UA that the user is not expected to need the video, or that minimizing unnecessary traffic is desirable.
    • "metadata": Hints to the UA that the user is not expected to need the audio stream, but that fetching its metadata (duration and so on) is desirable.
    • "auto": Hints to the UA that optimistically downloading the entire audio stream is considered desirable.
      Specifying the empty string is equivalent to specifying the value "auto".
  • controls = “controls” or “” (empty string) or empty
    Instructs the UA to expose a user interface for controlling playback of the audio stream.
  • loop = “loop” or “” (empty string) or empty
    Instructs the UA to seek back to the start of the audio stream upon reaching the end.
  • mediagroup = string
    Instructs the UA to link multiple videos and/or audio streams together.
  • src = URL potentially surrounded by spaces
    The URL for the audio stream.


Authors should ensure that the information and user interface components must be presentable to users in ways they can perceive (WCAG 2.0 - Principle 1: Perceivable). This includes providing alternatives for time-based media Guideline 1.2.

Formats and Codecs

The specification does not require a specific audio codec to be supported by all user agents. Using both Ogg/Vorbis and MP4/AAC seems to cover most user-agents, however. See the Audio format support on Wikipedia.


play a mp3 on webpage

<audio controls src="" type="audio/mp3">

View live example

Related specifications

HTML 5.1
W3C Working Draft
W3C Recommendation

See also

Other articles