Command guide
How to download MP3 with yt-dlp
One command gets you an MP3. The things that trip people up are ffmpeg being missing (you get .webm or .m4a instead), and expecting a higher bitrate to sound better than the source. Below are the commands for best quality, a fixed bitrate, whole playlists, and tagged files with cover art.
Quick answer
yt-dlp -x --audio-format mp3 "URL"-x (--extract-audio) keeps only the audio and --audio-format mp3 converts it with ffmpeg. If you end up with a .webm or .m4a file, ffmpeg is the first thing to check.
The one-flag shortcut: -t mp3
yt-dlp -t mp3 "URL"-t (--preset-alias) applies a built-in preset. -t mp3 expands to -f 'ba[acodec^=mp3]/ba/b' -x --audio-format mp3: it prefers a source stream that is already MP3 (no re-encode when one exists), otherwise falls back to the best audio and converts. It is the shortest way to ask for an MP3. Reach for the full -x --audio-format mp3 form below when you also want to set the quality, embed tags, or group a playlist — the preset does not take those for you.
Best quality MP3
yt-dlp -x --audio-format mp3 --audio-quality 0 "URL"--audio-quality takes a VBR level from 0 (best) to 10 (worst); the default is 5. yt-dlp already picks the best audio stream it can find, so -f bestaudio is not needed here.
For a fixed bitrate, pass it with a K suffix instead:
yt-dlp -x --audio-format mp3 --audio-quality 320K "URL"Quality reality check
MP3 is a lossy re-encode of whatever the site served. In our test, a 160 kbps AAC stream came out as a 254 kb/s MP3 with --audio-quality 0. The file is bigger, but it holds nothing the 160 kbps source did not. If you do not need MP3 specifically, yt-dlp -x "URL" keeps the original audio with no re-encode at all.
Add cover art, tags and a clean filename
yt-dlp -x --audio-format mp3 --audio-quality 0 \
--embed-thumbnail --embed-metadata \
-o "%(uploader)s - %(title)s.%(ext)s" "URL"--embed-thumbnail sets the thumbnail as the MP3's cover art and --embed-metadata writes the title and artist tags, so the file shows up properly in music players. The -o template names it Uploader - Title.mp3. If the cover art doesn't show up, see embedding thumbnails and metadata. More patterns are in the output template guide.
Download a whole playlist as MP3
yt-dlp -x --audio-format mp3 --audio-quality 0 \
-o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "PLAYLIST_URL"Each playlist gets its own folder with numbered tracks. Add -I 1:10 to take only the first ten items, and see the playlist guide for resuming and skipping files you already have.
Why ffmpeg matters
yt-dlp downloads the audio on its own, but the MP3 conversion, cover art and tags are all done by ffmpeg. Without it, the download succeeds and you are left with the original .webm or .m4a. Check that your terminal can find it:
ffmpeg -versionIf that fails, follow fix ffmpeg not found, or point yt-dlp at it directly with --ffmpeg-location /path/to/ffmpeg.
Most common failures
- • You get .webm or .m4a instead of .mp3: ffmpeg is missing or not on PATH
- • "Postprocessing: ffprobe and ffmpeg not found": same fix, install ffmpeg
- • The original file disappears: that is expected after conversion, add -k to keep it
- • A site wants you signed in for the best format: pass cookies
- • Files land in a random place: set an output template with -o
For builders
Using yt-dlp inside an app or script?
Paste a link to see what a managed media-import API returns — no install, no signup.
Building this into an app? See the API your backend calls instead
Frequently asked questions
What is the yt-dlp command to download MP3?
yt-dlp -x --audio-format mp3 "URL". -x (short for --extract-audio) keeps only the audio, and --audio-format mp3 converts it to MP3 with ffmpeg. Add --audio-quality 0 for the best variable bitrate.
How do I get the best quality MP3 with yt-dlp?
Add --audio-quality 0, which is the best VBR setting (0 is best, 10 is worst). yt-dlp already picks the best audio stream by default, so the only other limit is the source itself: an MP3 made from a 160 kbps stream will not sound better than that stream, even if the file reports a higher bitrate.
How do I download MP3 at 320 kbps or 192 kbps?
Pass a bitrate instead of a VBR level: --audio-quality 320K or --audio-quality 192K. This sets the encoder's bitrate. It does not add detail the source did not have.
Why does yt-dlp download a .webm or .m4a instead of MP3?
Without -x --audio-format mp3, yt-dlp saves the original audio stream, which is usually Opus in .webm or AAC in .m4a. If you did pass those flags and still got .webm or .m4a, ffmpeg is missing or not on your PATH, so the conversion step never ran.
How do I convert a whole playlist to MP3?
Pass the playlist URL with the same flags and an output template that groups files by playlist: yt-dlp -x --audio-format mp3 -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "PLAYLIST_URL". Use -I 1:10 to take only the first ten items.
Can I keep the original audio file as well as the MP3?
Yes. yt-dlp deletes the downloaded original after conversion. Add -k (--keep-video) to keep it next to the MP3.
Is yt-dlp a YouTube to MP3 converter?
Used this way, yes. yt-dlp -t mp3 "URL" (or the longer yt-dlp -x --audio-format mp3 "URL") does exactly what a "YouTube to MP3 converter" site does, from your own terminal, with no ads or upload limits, and it works on 1000+ sites, not just YouTube. The one requirement the web converters hide is ffmpeg: yt-dlp downloads the audio but ffmpeg does the MP3 conversion, so install it first.