New in HTML5.

<audio src=""> HTML Attribute

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
New Audio HTML Element: Master It Out Now With Our Code Example
What does <audio src=""> HTML Attribute do?
Specifies the source file for an audio element.

Code Example

<audio src="/wp-content/uploads/flamingos.mp3" controls>

src vs. <source>

If you are only going to provide a single source file format for the audio element, use the src attribute. If you wish to provide multiple source file formats, place two or more <source> elements inside the <audio> element.

Values of the src Attribute

Value NameNotes
urlThe URL of the audio file.

All Attributes of audio Element

Attribute nameValuesNotes
volume0.0–1.0Specifies the initial volume setting of the audio element, in a range from 0.0 to 1.0.
Requests a particular preload behavior to the browser, which the browser may or may not follow.
mutedSpecifies that the volume on the audio player should initially be muted.
loopSpecifies that the audio content should loop indefinitely once playback has begun.
controlsToggles the display of audio playback controls.
autoplaySpecifies that the audio playback should begin immediately on page load.
srcurlSpecifies the source file for an audio element.
Adam is a technical writer who specializes in developer documentation and tutorials.