HTML Background Music Widget

Embed looped ambient audio on your HTML website to set the mood, draw visitors in, and make their experience feel more vivid and immersive.
4.8 rating
10,000+ reviews
Free plan available
Create Widget for Free
No credit card needed
HTML Background Music Widget

Create your Background Music widget

Configure your widget and add it to your HTML website for free!

Screenshots

HTML Background Music Widget
1 / 6

Why People Love Elfsight

Music has a way of making a moment memorable. With the Elfsight Background Music widget, you can add background music to HTML pages in just a couple of clicks. Whether it’s calm instrumentals for a portfolio, upbeat tracks for an event page, or even seasonal playlists for a shop – you set the tone, and your visitors feel it instantly.

It’s quick to set up and even easier to manage. You don’t need to know how to add background music to HTML manually, or tinker with complicated scripts. Just design your player, copy one line of code, and paste it where you want the music to play.

Did you know?

A consumer survey found that 70% of customers feel more connected to a brand when listening to its tailored music selections.

Let your brand make that connection – add Background Music with Elfsight for free today and let your visitors feel what your brand sounds like.

Key Features of the HTML Background Music Widget

Here’s what makes this widget stand out:

  • Custom player styles: Match your music controls with your brand colors and fonts.
  • Flexible playback: Choose whether to autoplay, loop, or let visitors control playback.
  • Multiple tracks: Add one song or a whole playlist – perfect for special campaigns.
  • Works everywhere: From portfolios to online stores, it’s easy to embed or play background music in HTML.
  • Beginner-friendly: If you can copy and paste text, you can set this up—no need to edit HTML code for background music by hand.
  • Responsive design: The player works smoothly on desktop, tablet, and mobile.

Try the widget free in our live editor – no signup required

How to Add Background Music to HTML

You’ve got two simple ways to make it work:

Method 1: Inline Music Player

Great if you want music to play only on certain pages, like your homepage or a landing page. The player sits neatly inside your content where you place it.

  1. Select a Template: Open the Elfsight editor and pick your player style.
  2. Customize the Widget: Upload your tracks or link your source, adjust autoplay, loop, and volume settings.
  3. Generate the Code: Click “Add to website” and copy the code snippet.
  4. Embed on the Website: Paste it right where you want the player to appear in your HTML page.

Method 2: Floating Music Player

Ideal if you’d like the soundtrack to follow people as they scroll. The floating player stays visible at the bottom or side of the screen, so your music is always just a click away.

  1. Pick a Template: Select a floating layout like a bottom bar or sidebar.
  2. Customize the Widget: Add tracks, set design, playback, and playlist options.
  3. Generate the Code: Once you finish the customization, click “Add to website for free”, and copy the embed code from the editor.
  4. Embed on Your Website: Paste it into your HTML just before the closing </body> tag so it appears across the entire website.

Need more guidance? Visit our Help Center, explore our blog article on how to add background music to your website. Feel free to share new ideas in the Wishlist. For recent updates, check the Changelog.

Can I embed the Background Player on a plain HTML website?

Yes, you can add the Background Player to any HTML website by pasting the embed code into your page source where you want the music to load.

Do I need special hosting to use the widget on HTML?

No special hosting is required. As long as your HTML website supports JavaScript, the background audio player will function correctly.

What audio file formats are supported by the Background Music?

The player works with most common formats, including MP3, WAV, AAC, OGA, M4A, MP4A, WEBM audio, and other standard extensions supported by modern browsers.

Can I upload my own audio files or only use external links?

You can both upload audio files directly in the editor and add tracks via external URLs, giving you flexibility for HTML pages.

What is the maximum file size for uploaded tracks?

Each uploaded audio file can be up to 100 MB, which is suitable for long recordings or high-quality background music tracks.

Which external sources are supported?

The background audio solution supports SoundCloud, YouTube (video audio), Vimeo, Twitch, Wistia, and self-hosted audio files added to your HTML website.

Do I need API keys for YouTube or SoundCloud?

No API keys are required. Simply paste the media link into the widget, and it will handle playback without extra developer setup.

Can I show or hide the playlist on my HTML page?

Yes, you can display a visible playlist with track titles or keep it hidden for a clean, minimal background music experience.

Can shuffle or repeat be enabled by default?

You can preset Shuffle and Loop modes so tracks play in random order or repeat automatically when the player loads.

Does autoplay work on HTML websites?

Autoplay can be enabled, but most browsers require user interaction before sound starts, so visitors may need to click play first.

Can I add a custom background image to the player?

Yes, you can upload a custom image to use as the player’s background, replacing the default color with branded visuals.

Will Background Music pause other audio on mobile devices?

On smartphones, playing background music may pause other apps like Spotify because mobile systems usually allow only one active audio source.

Pricing

14-day money back guarantee. Risk-free, you can cancel at anytime.
Elfsight Apps
Multi-platform digital solution
from $0 / month
start with free plan
Unlimited domains
24/7 customer support
Charge-free installation service
Special offer for multiple apps
Fully customizable