WebToolsPlanet
Developer Tools

HTML Audio Generator

Configure an HTML5 <audio> element — sources, playback controls, and preload — and copy the ready-to-use HTML.

Last updated: May 21, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is HTML Audio Generator?

The HTML `<audio>` element embeds an audio player in a web page. Multiple `<source>` child elements let you specify the same audio file in different formats; the browser plays the first one it supports. Common format order is MP3 (widest support), then OGG Vorbis, then WAV.

Key attributes: `controls` shows the browser's native playback bar; `autoplay` starts playback immediately (browsers may block this without user interaction); `loop` repeats the track; `muted` starts silenced; `preload` hints how much audio data to fetch before the user presses play.

How to Use HTML Audio Generator

1

Enter the audio source URL and choose its MIME type (MP3, OGG, WAV)

2

Add additional sources for cross-browser compatibility

3

Set the preload strategy

4

Toggle controls, autoplay, loop, and muted

5

Copy the generated HTML

Common Use Cases

  • Embedding background music or sound effects in a web page.
  • Adding podcast audio without a third-party player.
  • Generating cross-browser audio markup with multiple source formats.

Example Input and Output

An audio player with MP3 and OGG sources and controls.

Configuration
Sources: audio.mp3 (audio/mpeg), audio.ogg (audio/ogg)
Controls: true, Preload: metadata
HTML output
<audio preload="metadata" controls>
  <source src="audio.mp3" type="audio/mpeg">
  <source src="audio.ogg" type="audio/ogg">
  Your browser does not support the audio element.
</audio>

Privacy

All HTML generation runs in your browser. No data is sent to any server.

Frequently Asked Questions

Why list MP3 first?
MP3 has the broadest browser and device support including Safari on iOS. OGG Vorbis is open and smaller but not supported by Safari without a plugin. WAV is uncompressed and large. List MP3 first, OGG second as a fallback.
Does autoplay work on mobile?
Most mobile browsers block autoplay with audio unless the user has already interacted with the page. Combine autoplay with muted if you need reliable auto-start, but even then mobile browsers vary in their policies.