Most of us stream the vast majority of our music, but sometimes that’s not an option.

That’s where downloading songs or music videos for offline listening comes in.

Downloading music from YouTube is legal if you pay for YouTube Premium.

A screenshot of the NewPipe app for Android

All other methods to download songs from YouTube are free, but they may not always be legal.

Both services allow you to download music from YouTube, plus come with other features such as removing ads.

(Just don’t upload any copyright-protected material).

A screenshot of the YouTube Download shortcut on the iPhone

I’ve done my best to recommend safe programs, but I can’t predict what the future holds.

Always do research before downloading an unofficial app from the internet.

Here’s how to install it:

Download theNewpipe apk.

A screenshot of the 4K YouTube to MP3 downloader app

initiate the downloaded file on your Android phone.

You may see a warning and a request for your permission to install NewPipe.

Grant this request and go back to the installer.

Once the installation is complete, open NewPipe and search for the music you want to download.

TapDownload, followed byAudio, and NewPipe will save the song for you.

Install two more apps on your iPhone:Scriptableanda-Shell mini.

kick off the YouTube video in Safari or in the YouTube app.

Tap the Share button, which will reveal the share sheet.

Scroll down and selectYouTube Downloadfrom the list of shortcuts towards the bottom.

YouTube Download will ask for a bunch of permissions.

Unfortunately, you’ll need to grant all of these for the shortcut to do its job.

When it asks whether you want to download audio or video, selectDownload Audio.

you could also choose the audio format you prefer.

(I chose mp3.)

Finally, the shortcut will ask where you want to save the downloaded file.

The downloaded audio file will then be saved on your iPhone.

you might repeat this process for pretty much any video on YouTube.

Install 4K YouTube to MP3.

Paste the YouTube URL in the app and let the app handle the rest.

Personally, I find the initial setup a bit cumbersome.