HTML <bgsound> Tag

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 3 Examples
Legacy Media

What You’ll Learn

By the end of this tutorial, you’ll understand legacy background sound markup and what to use instead in modern HTML.

01

Historical Syntax

How <bgsound> auto-played audio via a src attribute.

02

IE-Only Attributes

Understand loop, volume, and balance from old Internet Explorer.

03

Deprecated Status

Why <bgsound> is not part of HTML5 and is ignored today.

04

bgsound vs audio

Compare legacy auto-play with the modern <audio> element.

05

Modern Replacement

Use <audio> with controls, loop, and muted.

06

Legacy Maintenance

Recognize bgsound in old tutorials and migrate to HTML5 audio.

What Was the <bgsound> Tag?

The <bgsound> element was a non-standard, IE-specific void tag that pointed to a sound file via src. The browser played it automatically in the background with no visible controls.

⚠️
Deprecated — Use <audio> Instead

Do not use <bgsound> in new projects. Modern browsers ignore it. Use the HTML5 <audio> element with controls so users can play, pause, and mute.

In the 1990s and early 2000s, developers used <bgsound> for ambient music and sound effects. Today the same goals are met with <audio>, which supports user controls and cross-browser formats.

use-audio-instead.html
<audio src="/audio/count.mp3" controls loop muted>
  Your browser does not support the audio element.
</audio>

📝 Syntax (Historical)

Legacy HTML placed <bgsound> in the document body with a src pointing to an audio file:

syntax.html
<bgsound src="soundfile.wav">
  • <bgsound> is a void element—no closing tag or inner content.
  • Sound started automatically on page load with no built-in pause or mute UI.
  • Supported mainly in Internet Explorer; modern browsers ignore the tag entirely.

⚡ Quick Reference

AttributeCode SnippetNotes
src<bgsound src="file.wav">URL to WAV, MIDI, or MP3 (IE only)
looploop="infinite"Repeat sound continuously (IE only)
volumevolume="50"0–100 volume level (IE only)
balancebalance="0"Stereo balance -100 to 100 (IE only)
Modern loop<audio loop>Boolean attribute on HTML5 audio
Modern controls<audio controls>User-visible play/pause/mute UI

⚖️ <bgsound> vs <audio>

The HTML5 <audio> element replaced background sound with a cross-browser, user-controlled API:

Feature<bgsound><audio>
StatusDeprecated, IE-onlyHTML5 standard, all modern browsers
User controlsNonecontrols attribute
AutoplayAlways on page loadautoplay + usually muted
Looploop="infinite"Boolean loop attribute
AccessibilityNo pause UIUsers can stop playback
migration.html
<!-- Legacy (do not use) -->
<bgsound src="background_music.mp3" loop="infinite">

<!-- Modern replacement -->
<audio src="/audio/count.mp3" controls loop muted>
  Your browser does not support the audio element.
</audio>

🧰 Attributes (Historical)

Internet Explorer recognized these attributes on <bgsound>:

src Required

URL of the sound file to play on page load.

src="/audio/count.mp3"
loop IE only

Set to infinite to repeat the sound continuously.

loop="infinite"
volume IE only

Volume level from 0 to 100.

volume="50"
balance IE only

Stereo balance from -100 (left) to 100 (right).

balance="0"
attributes.html
<bgsound src="/audio/count.mp3" loop="infinite">

All bgsound attributes are historical only. The entire element is deprecated and ignored by modern browsers.

Examples Gallery

Historical bgsound patterns plus the modern <audio> replacement. Legacy examples are for learning only—they will not play in modern browsers.

👀 Live Preview

The modern way to add sound—a visible <audio> player:

Legacy Background Sound

How <bgsound> looked in old HTML. For learning only—it will not play in modern browsers.

⚠️ This tag is ignored by all modern browsers.
legacy-bgsound.html
<bgsound src="/audio/count.mp3">

📚 Common Use Cases (Historical)

In the 1990s and early 2000s, developers used <bgsound> for ambient music and sound effects. Today the same goals are met with <audio>.

Looping Background Music

IE supported loop="infinite" to repeat background music. The <audio> tag uses the boolean loop attribute instead.

loop-bgsound.html
<bgsound src="/audio/count.mp3" loop="infinite">

Modern <audio> Replacement

This is what beginners should use today. The controls attribute gives users a play/pause button; add muted if you need autoplay.

audio-replacement.html
<audio src="/audio/count.mp3" controls autoplay loop muted>
  Your browser does not support the audio element.
</audio>

🧠 How <bgsound> Worked

1

Author added bgsound with src

Point src at a WAV, MIDI, or MP3 file in the page body.

Markup
2

IE played sound on load

Internet Explorer started playback automatically with no visible player.

IE only
3

HTML5 audio replaced it

The <audio> element brought cross-browser sound with user controls.

Evolution
=

Today: use <audio>

Learn bgsound for history. Build real projects with the <audio> tag.

Browser Support

<bgsound> was Internet Explorer only. Modern browsers never supported it and ignore the tag entirely.

Deprecated · Not in HTML5

Ignored by all modern browsers

Chrome, Firefox, Safari, Edge, and Opera never implemented <bgsound>. Only legacy Internet Explorer played background sound this way.

0% Modern support
Google Chrome Never supported · Ignored
Not supported
Mozilla Firefox Never supported · Ignored
Not supported
Apple Safari Never supported · Ignored
Not supported
Microsoft Edge Never supported · Ignored
Not supported
Internet Explorer Legacy only · EOL
Legacy only
Opera Never supported · Ignored
Not supported

Why bgsound was replaced

No user controls, poor accessibility, and HTML5 audio made the tag obsolete.

🔊
No pause or mute UI Users could not stop auto-playing background music
A11y
🎧
HTML5 <audio> Cross-browser sound with controls and multiple formats
Replacement
<bgsound> tag 0% modern support

Bottom line: Do not use <bgsound> in new projects. Use the HTML5 <audio> element instead.

Conclusion

The <bgsound> tag is a piece of web history—useful to recognize in old code, but not for new sites. Beginners should learn the <audio> tag for all webpage sound, always include controls, and respect modern autoplay policies with muted when needed.

💡 Best Practices

✅ Do

  • Use <audio> for all sound in new projects
  • Always add controls so users can pause or mute
  • Include fallback text inside <audio>
  • Learn bgsound only to read legacy HTML

❌ Don’t

  • Use <bgsound> in any new HTML code
  • Autoplay loud music without user consent
  • Expect bgsound to work outside old Internet Explorer
  • Hide audio controls when users need to stop playback

Key Takeaways

Knowledge Unlocked

Six truths every developer should know about <bgsound>

Bookmark these before you ship — they’ll keep you on the modern HTML5 path.

6
Core concepts
🔊 02

Auto-Play Only

No visible controls—users could not pause or mute background music.

Behavior
🎧 03

Use <audio> Today

HTML5 <audio> with controls is the modern replacement.

Migration
🔀 04

Loop Attribute

loop="infinite" on bgsound became boolean loop on audio.

Syntax
🚫 05

Modern Browsers Ignore It

Chrome, Firefox, Safari, Edge, and Opera never supported bgsound.

Compatibility
🔈 06

Autoplay Needs muted

Modern browsers require muted for autoplay policies.

Policy

❓ Frequently Asked Questions

It embedded background sound that played automatically when a page loaded, mainly in Internet Explorer, with no visible player controls.
No. It is deprecated and not in the HTML5 spec. Modern browsers ignore it.
The HTML5 <audio> element. Use controls, and optionally autoplay, loop, and muted.
Primarily Internet Explorer. Chrome, Firefox, Safari, and Edge never natively supported it.
No. Learn it to understand old HTML, but always use <audio> for real projects.

Learn the Modern Way

Skip deprecated bgsound. Practice background audio with the HTML5 audio tag in the Try It editor.

Try audio Tag →

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.

6 people found this page helpful