An interview or sound sample can sit next to the text that gives it context. The HTML <audio> element embeds the recording so visitors can listen without leaving the page.
With controls present, the browser supplies Play, Pause, and volume controls. Leaving out autoplay lets visitors decide when the sound starts.
The recording stays in a separate file. A filename in src points to the same folder as the HTML page, so the file must be available alongside the page wherever it is served.
Steps to embed audio in HTML:
- Create
audio.htmlin a new empty test folder using your text editor. - Copy a playable MP3 into the same folder as
audio.htmlunder a simple name such assample.mp3, using only ASCII letters, digits, and hyphens before the.mp3extension. - Enter the following markup in
audio.htmlwith your MP3 filename insrc.<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Audio sample</title> </head> <body> <h1>Audio sample</h1> <audio controls src="sample.mp3"></audio> </body> </html>
sample.mp3stands for your audio file. The filename insrcmust match the filename on disk, including capitalization. - Save
audio.html. - Open the saved
audio.htmlin desktop Chrome.
- Click Play below the Audio sample heading.
The player shows the Pause button and the elapsed time starts counting up. If playback never starts, check that the MP3 next to
audio.htmlplays on its own and that its simple filename matchessrc, including capitalization.
- Click Pause while the elapsed time is advancing.

- Verify that the elapsed time stays at the paused position for several seconds.
The Play triangle returns, and the elapsed time holds below the total duration. For the recording shown, it holds at
0:18of3:00.