The loop attribute is a boolean attribute on <video> and <audio>. When present, the player seeks back to the start when the media reaches the end — so playback repeats.
Pair it with controls so users can pause. For decorative background clips, combine with autoplay and muted (audible autoplay is often blocked).
Baseline · Widely available.
Not deprecated and not experimental on audio/video. Stable across modern browsers since about July 2015.
Offer a way to stop.
Looping motion or sound can distract or overwhelm. Keep controls (or another pause control) so users can stop playback.
Syntax
HTML Syntax
syntax.html
<video|audio loop>
Boolean attribute: write loop alone. loop="false" does not disable it — remove the attribute entirely.
Values
Attribute Values
loop has no keyword list. Presence means repeat; omission means play once:
Value / pairing
Description
Try it
loop (present)
When the media ends, seek to the start and continue
Toggle loop, then press play. With loop on, the clip restarts at the end instead of stopping.
Options
Sample clip from /video/count.mp4. Let it reach the end to see looping.
Video
loop + muted
Code
HTML Examples
Short, copy-ready snippets. Use Try It Yourself for a live editor.
Example 1 — Looping Video with Controls
Repeat a short clip and keep the browser’s play/pause UI available.
HTML
<video width="400" height="225" controls loop>
<source src="/video/count.mp4" type="video/mp4">
Your browser does not support the video element.
</video>
Press play and wait for the end — playback should restart.
How It Works
loop tells the player to seek to the start when the clip ends.
controls shows play, pause, and seek so users stay in control.
<source> points at the media file (here MP4).
Fallback text appears only if the browser cannot play video.
Example 2 — Looping Audio
Same boolean on <audio>. Provide multiple sources for broader codec support.
HTML
<audio controls loop>
<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>
Play the track; when it ends, it should start again.
How It Works
loop on audio restarts the track after the last sample.
Two <source> files let the browser pick MP3 or OGG.
controls is important — looping sound without pause is poor UX.
User starts playback with the play button (no autoplay here).
Example 3 — Muted Autoplay Hero Loop
Silent background-style video: autoplay, muted, looping, with controls for pause.
HTML
<video
width="400"
height="225"
autoplay
muted
loop
playsinline
controls
poster="/images/html-loop-attribute.webp">
<source src="/video/count.mp4" type="video/mp4">
Your browser does not support the video element.
</video>