How to add an audio player to an HTML webpage?

The HTML <audio> element is used to add audio to web page. To add an audio player, add the controls attribute.

The following three audio formats are supported in HTML − MP3, Wav, and Ogg.


You can try to run the following code to add an audio player to an HTML web page

Live Demo

<!DOCTYPE html>
      <title>HTML audio Tag</title>
      <p>Click on Play button...</p>
      <p>(Song: Kalimba which is provided as a Sample Music in Windows)</p>
      <audio controls>
         <source src = "/html/Kalimba.mp3" type = "audio/mpeg">

Updated on: 16-Jun-2020

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started