HTML Tags

HTML <audio> Tag

The <audio> tag is used to embed sound content in an HTML document, such as music, podcasts, or sound effects.
It supports multiple audio formats and provides playback controls like play, pause, and volume.

Syntax

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

Attributes

AttributeDescriptionExample
srcSpecifies the path to the audio file.src="song.mp3"
controlsDisplays play, pause, and volume controls.controls
autoplayAutomatically starts playing the audio.autoplay
loopRepeats the audio after it ends.loop
mutedStarts the audio in a muted state.muted
preloadSpecifies how the audio should be loaded. Values: none, metadata, auto.preload="auto"

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Audio Tag Example</title>
</head>
<body>
  <h2>Example: Embedding an Audio File</h2>
  <audio controls preload="metadata">
    <source src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" type="audio/mpeg">
    <source src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.ogg" type="audio/ogg">
    Your browser does not support the audio element.
  </audio>
</body>
</html>

Output

Browser Output

Displays a built-in audio player with play, pause, volume, and timeline controls.
Use our Try It Editor to test and hear the output with your own audio file.

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes✅Yes

The <audio> tag is fully supported by all major browsers.
Older browsers (IE8 and below) do not fully support HTML audio playback.
However, some IE version may support different audio formats such as MP3, OGG, or WAV.

Notes

  • You can include multiple <source> elements to ensure cross-browser compatibility.
  • If the browser doesn’t support the <audio> tag, the fallback text inside will be displayed.
  • Avoid using autoplay without user consent to prevent accessibility and UX issues.

Conclusion

The <audio> tag provides an easy and standardized way to integrate sound into web pages.
By combining multiple formats and attributes, you can create rich multimedia experiences with full browser compatibility.

Sign In Form

User your email and password to singn in

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend