Toggle controls, loop, and muted on a real <audio> element.
A real <audio> using /audio/count.mp3. Toggle chips, then press Apply (or the chip itself).
Player
controls on · loop off · muted off
Code
HTML Examples
Short, copy-ready snippets. Use Try It Yourself for a live editor.
Example 1 — Basic Player with Controls
Embed one file and show the native player UI.
HTML
<figure>
<figcaption>Sample count audio</figcaption>
<audio src="/audio/count.mp3" controls>
Your browser does not support the audio element.
<a href="/audio/count.mp3">Download MP3</a>.
</audio>
</figure>
Autoplay may still be blocked by browser policy; keep controls so users can start playback.
How It Works
autoplay asks the browser to start as soon as it can.
muted improves the chance autoplay is allowed (sound starts off).
Keep controls so users can unmute and pause.
Do not rely on unmuted autoplay — many sites block it for a better user experience.
Edge Cases & Pitfalls
Most audio bugs come from autoplay policy, missing controls, or format support.
ux
Always give a way to play and stop
Without controls (or custom UI), users may hear nothing and have no player. Prefer visible controls.
policy
Unmuted autoplay is unreliable
Browsers often require a user gesture. Prefer opt-in play; use muted autoplay only when necessary.
formats
Not every codec works everywhere
Offer multiple <source> formats (commonly MP3 plus OGG or another fallback).
a11y
Transcripts beat missing captions
<audio> does not support WebVTT like <video>. Provide a transcript for speech-heavy clips.
api
muted="false" does not unmute
Boolean attributes: if muted is present, it is muted. Remove the attribute (or use the DOM API) to unmute.
hint
controlslist is only a hint
Values like nodownload may hide UI in some browsers but are not a security boundary — users can still obtain the file URL.
Compatibility
Browser Support
The <audio> element is core HTML media in every modern browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
<audio>
Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera support the element; codec support and autoplay rules still differ by browser and OS.
97%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetAll
Full support
Internet Explorer9+
Partial
<audio>Widely supported
Bottom line: Safe to use with controls and a format fallback. Treat autoplay, controlslist, and loading="lazy" as progressive extras.
Remember
Key Takeaways
Role:<audio> embeds sound; controls gives users a real player.
Formats: use nested <source> when one codec is not enough.
Autoplay: prefer user play; muted autoplay is the safer pattern when needed.
Access: fallback links plus a transcript for spoken content.
One line: a good <audio> has a playable source, controls, and a simple fallback.
UA style
Default CSS Settings
Without controls, many browsers hide the element. With controls, the player is typically an inline replaced element. A common UA idea looks like this:
You can style the outer player box (width, margin, border). Individual control chrome is browser-specific — use custom UI via the media element API if you need a consistent look.
Frequently Asked Questions
The audio element embeds sound in a page. With the controls attribute, the browser shows a native player for play, pause, seek, and volume — no plugin required.
Use src on audio for one file. Use nested source elements when you offer multiple formats (for example MP3 and OGG); the browser picks the first format it can play.
Most browsers block autoplay with sound until the user interacts with the page. Prefer controls and a clear play action. If you must autoplay, muted autoplay is more likely to be allowed.
Not the same way. audio does not support WebVTT track the way video does. Provide a transcript (and consider video if you need timed captions).
Fallback content for older browsers — for example a short note and a download link. Supporting browsers hide that fallback and show the player instead.
No. muted is a boolean attribute: if it is present, the audio starts muted. Remove the attribute entirely to start unmuted.