</> Code Corner

HTML · HTML Media · Lesson 48

HTML Audio

Play sound with <audio>.

The HTML <audio> element is used to play an audio file on a web page.

Example

<audio controls>
  <source src="https://www.w3schools.com/html/horse.ogg" type="audio/ogg">
  <source src="https://www.w3schools.com/html/horse.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
Format Media type
MP3 audio/mpeg
OGG audio/ogg
WAV audio/wav
Tip: Like video, add muted if you use autoplay, and loop to repeat.

Keep reading “HTML Audio”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋