HTML <bgsound> Tag

Beginner
5 min read
Updated: Oct 2026
3 examples
Obsolete

Definition and Usage

The <bgsound> element was an Internet Explorer–only tag that played a background sound when the page loaded. It used src for the file and loop to repeat it.

Study it for legacy pages only. For real audio today, use <audio> with user controls.

Obsolete & non-standard.

Never part of standardized HTML for authors. Modern browsers ignore it. Do not use in new projects.

Use instead.

Prefer <audio> (optionally with <source>). Avoid surprise autoplay; give users pause and mute controls.

HTML Syntax

syntax.html
<bgsound src=" sound.mid" loop="infinite">

Historically written as an empty / void-like tag (sometimes self-closing). It never validated as standard HTML. Today it does nothing in current browsers.

Attributes

Historical IE attributes on <bgsound> (all obsolete with the element):

AttributeDescriptionTry it
srcURL of the sound file (historically .wav, .au, or .mid)Try it
loopHow many times to play: a number, or the keyword infiniteTry it
balanceStereo balance from -10000 (left) to 10000 (right)Legacy only
volumeLoudness from -10000 (quiet) to 0 (loudest in IE’s scale)Legacy only

Global Attributes

The <bgsound> tag also supports the Global Attributes in HTML (when parsed as an element), though they never made the tag useful in modern browsers.

Live Preview

<bgsound> does not play here. Compare the legacy markup idea with a modern <audio> control (starts muted).

Educational preview only. Prefer user-controlled <audio> in real sites.

Preview
<bgsound src="sound.mid" loop="infinite"> — ignored by modern browsers. No sound plays.

Legacy mode — markup shown; audio engine does not run.

HTML Examples

Short snippets for study. Use Try It Yourself for a live editor — legacy tags show a notice; the modern example uses real <audio>.

Example 1 — Basic Background Sound (Legacy)

Historical IE markup that pointed at a sound file with src.

HTML
<!-- Legacy IE only — ignored today -->
<bgsound src="sound.mid">

<p>Page content continues here.</p>
Try It Yourself

How It Works

  1. Add <bgsound> with a src pointing at a sound URL.
  2. Old IE would start playback when the page loaded.
  3. No visible UI — users could not pause or mute easily.
  4. Today: the tag is unknown; browsers show no sound and no controls.

Example 2 — loop="infinite" (Legacy)

Repeat the background track forever in old Internet Explorer.

HTML
<!-- Legacy IE only -->
<bgsound src="theme.au" loop="infinite">

<p>Music would loop in old IE. Modern browsers ignore this tag.</p>
Try It Yourself

How It Works

  1. Set loop to a number (play N times) or infinite.
  2. Optional volume / balance adjusted loudness and stereo in IE only.
  3. Endless autoplay was hard for users to stop — a major UX problem.
  4. Modern equivalent: <audio loop controls> (and mute by default if autoplaying).

Example 3 — Modern Replacement with audio

Use <audio> with controls. Start muted if you also try autoplay.

HTML
<p>Use audio instead of bgsound:</p>
<audio src="/audio/count.mp3" controls loop muted>
  Your browser does not support the audio element.
</audio>
Try It Yourself

How It Works

  1. Replace <bgsound> with <audio>.
  2. Add controls so users can play, pause, and change volume.
  3. loop repeats like the old infinite loop when desired.
  4. muted helps autoplay policies and avoids surprising people with loud sound.

Edge Cases & Pitfalls

Most issues today are expectations that background tags still play sound.

obsolete

Never ship bgsound

It fails silently in modern browsers. Replace it when you find it in old code.

a11y

No silent autoplay

Unexpected audio fails accessibility expectations. Always provide visible controls.

policy

Autoplay is restricted

Even with <audio autoplay>, many browsers block unmuted playback until a user gesture.

formats

MIDI / AU are not enough

IE’s .mid/.au focus does not map to modern web audio. Prefer widely supported formats with <audio>/<source>.

DOM

Parsed as unknown

In current engines, bgsound is an HTMLUnknownElement (Firefox once wrongly used a span interface).

Browser Support

The <bgsound> element is obsolete and non-standard. MDN removed its docs as irrelevant. Only legacy Internet Explorer played it.

✓ Obsolete · Non-standard

<bgsound>

No support in modern Chrome, Firefox, Safari, Edge, or Opera. Internet Explorer was the historical engine. Use audio instead.

0% Modern support
Google Chrome Never supported
Not supported
Mozilla Firefox Never supported
Not supported
Apple Safari Never supported
Not supported
Microsoft Edge Chromium · no bgsound
Not supported
Opera Never supported
Not supported
Internet Explorer Legacy only · EOL
Legacy only
<bgsound> Not supported

Bottom line: Learn <bgsound> for history and audits only. Ship sound with <audio controls>.

Key Takeaways

  • Role: IE-only background soundtrack — never standardized.
  • Attrs: src, loop, balance, volume (historical).
  • Status: obsolete and non-standard — ignored everywhere modern.
  • Replace with: <audio controls> (loop/muted as needed).

One line: <bgsound> is web history — use <audio> with controls instead.

Default CSS Settings

Unknown / obsolete elements like bgsound are not meant to render as media UI. Engines typically treat them as non-replaced unknown elements:

default.css
bgsound {
  display: none;
}

Do not style bgsound for production. Style your visible <audio controls> player instead.

Frequently Asked Questions

bgsound was an Internet Explorer–only element that played a background sound when the page loaded, using attributes like src and loop.
No. It is obsolete and non-standard. It was never in the HTML Living Standard for authors. Modern browsers ignore it.
Use the HTML audio element with controls so users can play, pause, and mute. Prefer muted autoplay only when you truly need background sound and browsers allow it.
Historically .wav, .au, and .mid. Modern audio uses formats such as MP3, Ogg, and WAV via the audio element and source children.
No. Native support was effectively Internet Explorer only. Other browsers treat it as an unknown element and do not play sound.
Unexpected sound harms accessibility and annoys users. Always provide controls, and mute by default if you attempt autoplay.

Next: big

See another obsolete presentational tag and what CSS replaces it.

big tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful