The audio element of HTML5 as well allows us to embed video content into websites in a standard manner. Before HTML5 sounds, music, and so on, were being played (embedded) through a third party software, such as Flash, or others. In HTML4 however it could have been embedded via an <object> element.




  • src - Provides the path of the audio file in form of URL.
  • type - Defines MIME-type of the media source.
  • autoplay - Tells a browser whether to start playing the audio as soon as it loads or not; value is Boolean.
  • controls - If enabled, provides a browser default audio controls; a Boolean value.
  • muted - A weird attribute that may be used to mute an automatic play during loading or other states; not well supported by browsers.
  • loop - Makes audio play in an infinite loop (repentance); a Boolean value.
  • preload - Suggests a browser how to preload a audio; ultimately it depends on browser how to do it. These values are allowed:
    • metadata - Allows preloading metadata of the audio source
    • auto - Allows browser to decide what data will be preloaded (metadata, entire audio or nothing)
    • none - If the user is not expected to view the audio clip, preloading may be prevented
  • global attributes
  • event attributes

These media types are currently supported by HTML5:

  • MP3 or MPEG-3 (.mp3); MIME-type is audio/mp4
  • Wav (.wav); MIME-type is audio/wav
  • Ogg (.ogg); MIME-type is audio/ogg


Example of a basic usage of audio element in HTML5:


›› go to examples ››