Download the Spotify track you want to use, if available for offline use
Check that you have the legal right to use the audio as a ringtone
Use a ringtone maker or audio editor to convert the song into a ringtone-compatible file
Trim the audio to a short section, usually 20 to 30 seconds
Export the trimmed audio as MP3, M4R, or another supported ringtone format
Transfer the file to your phone
On iPhone, add the file to the Tones section in Finder or iTunes, then set it in Settings > Sounds & Haptics > Ringtone
On Android, move the file to the Ringtones folder, then set it in Settings > Sound > Phone ringtone
If the song is protected or unavailable for export, use a licensed ringtone source instead
