How to Embed MP3 Audio Files In Web Pages with the help of Google Drive

Audio hosting websites like SoundCloud or Anchor.fm make it easy for you to embed audio files in your web pages and blogs. Just upload your file - like an MP3 song or an audio podcast - to any of these sites and they’ll provide the HTML embed code that you can copy-paste in your web template. Simple!

If you have been storing your MP3 files inside Google Drive, you can embed the files directly from Drive without having to upload them to another website. The Drive MP3 player can be embedded on any website that supports IFRAME and the list includes Blogger, WordPress, Medium or even the new Google Sites.

Also see: Embed YouTube as Audio Player

Step 1: Upload the MP3 to Google Drive

Open drive.google.com and upload the MP3 to your Google Drive. After the file is uploaded, right-click to share and set the sharing permission to “Anyone on the Internet can find and view”.

Step 2: Generate the Player Embed Code

The Google Drive URL will have the following structure:

https://drive.google.com/file/d/1234xyz/view?usp=sharing

Now all you have to do is replace /view with /preview and wrap the modified URL in an IFRAME tag as shown below:

<iframe
  frameborder="0"
  width="400"
  height="200"
  src="https://drive.google.com/file/d/1234xyz/preview">
</iframe>

Here’s a live example. The embedded MP3 player has volume controls, play/pause buttons, seek bar, no Google branding, it works on mobile and the play also auto-detects and displays the duration of the music file.

The MP3 file is hosted on Google Drive and embedded here inside the IFRAME tag.

Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.