The autoplay attribute is a boolean attribute on <video> and <audio>. When present, the browser should begin playback as soon as it has enough media data — without waiting for the user to press play.
Modern browsers block autoplay with sound. Silent media (no audio track) or media with muted usually can autoplay. Pair autoplay with controls so users can pause or unmute.
Baseline · Widely available.
Not deprecated and not experimental. The attribute is widely supported; whether playback actually starts still depends on each browser’s autoplay policy.
Unexpected sound hurts UX.
MDN advises careful use. Prefer muted video for decorative clips. Avoid surprising users with audible autoplay — it fails accessibility expectations and is often blocked anyway.
Syntax
HTML Syntax
syntax.html
<video|audio autoplay>
Boolean attribute: write autoplay alone. autoplay="false" does not disable it — remove the attribute entirely.
Values
Attribute Values
autoplay itself has no keyword list. Related attributes decide whether browsers allow it:
Value / pairing
Description
Try it
autoplay (present)
Request automatic start when enough data is buffered
Toggle muted, then press Restart. Unmuted autoplay is often blocked until you interact with the page.
Options
Sample clip from /video/count.mp4. Keep muted for reliable autoplay.
Video
autoplay + muted
Code
HTML Examples
Short, copy-ready snippets. Use Try It Yourself for a live editor.
Example 1 — Muted Video Autoplay
MDN’s recommended pattern for clips that should start without a click.
HTML
<video width="400" height="225" controls autoplay muted playsinline>
<source src="/video/count.mp4" type="video/mp4">
Your browser does not support the video element.
</video>
Press play here if needed. Try It Yourself uses autoplay on a fresh load.
How It Works
autoplay requests playback as soon as enough data is ready.
muted makes the clip inaudible so most browsers allow autoplay.
playsinline keeps playback in-page on many mobile Safari builds.
controls lets users pause or unmute when they want sound.
Example 2 — Audio with Autoplay
Audible audio autoplay is usually blocked until the user interacts with the site.
HTML
<audio controls autoplay>
<source src="/audio/count.mp3" type="audio/mpeg">
<source src="/audio/count.ogg" type="audio/ogg">
Your browser does not support the audio element.
</audio>
Use the play button — unmuted autoplay is often blocked without a gesture.
How It Works
autoplay on <audio> asks for automatic start with sound.
Policy check. Browsers commonly require a prior click/tap/keypress, mute, or site allowlist.
Always keep controls so playback remains user-operable when autoplay fails.
Prefer user-started audio for music or narration — unexpected sound is jarring.
Example 3 — Looping Muted Hero Clip
Background-style video: silent, inline, looping, with controls for pause.
HTML
<video
width="400"
height="225"
autoplay
muted
loop
playsinline
controls
poster="/images/html-autoplay-attribute.webp">
<source src="/video/count.mp4" type="video/mp4">
Your browser does not support the video element.
</video>
loop restarts the clip for a continuous background feel.
playsinline avoids fullscreen takeover on many phones.
poster shows a still if playback is delayed or blocked.
Edge Cases & Pitfalls
Most “broken autoplay” reports are browser policy, not missing HTML.
policy
Sound is usually blocked
Autoplay of audible media needs mute, a user gesture, or allowlisting. Silent video or muted is the reliable path.
boolean
autoplay="false" still autoplays
Presence of the attribute means true. Delete the attribute to turn autoplay off (same rule for muted).
script
play() counts as autoplay
Calling media.play() outside a user-input handler follows the same blocking rules. Prefer the HTML attribute when you can; handle the rejected promise if you use play().
mobile
Add playsinline on iOS
Without it, Safari may force fullscreen and refuse the muted-autoplay pattern you expect on the page.
a11y
Always offer pause
Moving or flashing content needs a way to stop. Keep controls (or an equivalent pause control) on autoplaying media.
Compatibility
Browser Support
autoplay is an HTML attribute on media elements in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
autoplay
The attribute is widely supported on audio and video. Actual autoplay success depends on muted state, user gestures, and each browser’s policy — not only on the attribute existing.
97%Attribute support (approx.)
Google ChromeSupported · blocks audible
Full support
Mozilla FirefoxSupported · blocks audible
Full support
Apple SafariSupported · needs playsinline
Full support
Microsoft Edge79+
Full support
OperaModern · Full
Full support
Samsung InternetModern · Full
Full support
Internet Explorer9+ (partial media)
Partial
autoplayWidely supported · policy varies
Bottom line: Write muted + controls + playsinline for decorative video. Treat unmuted autoplay as unreliable and often undesirable.
Remember
Key Takeaways
Role: boolean hint on audio/video to start playback without a Play click.
Mute to succeed: audible autoplay is usually blocked; use muted or no audio track.
Mobile: add playsinline; keep controls for pause/unmute.
Boolean trap: presence = on; autoplay="false" still means on.
One line: autoplay works best when media is silent (or muted) and users can still pause it.
Frequently Asked Questions
On audio or video, it asks the browser to start playback as soon as enough media data is available, without the user pressing play.
Most browsers block autoplay with sound. Mute the media (muted attribute or no audio track), wait for a user gesture, or rely on site allowlisting. Prefer muted autoplay for background clips.
No. autoplay is a boolean attribute. If the attribute is present at all, it is treated as true. Remove the attribute entirely to disable it.
The HTML audio and video elements. Scripted play() outside a user gesture is also treated as autoplay and follows the same browser policies.
On iOS Safari, playsinline helps video play in place instead of forcing fullscreen, which is often required for reliable muted autoplay.
Usually no. Unexpected sound harms accessibility and UX. Prefer user-started playback with visible controls.