How to sort a rekordbox playlist by key and BPM

rekordbox cannot sort by key and BPM at the same time. rekordbox and the players sort one column at a time, and that sort is only a view, so it disappears the moment you export to USB. Bake'n Deck's Sort rewrites the track order inside every playlist of your exported collection.xml: Camelot key ascending, BPM ascending inside each key. Because the order lives in the playlist and not in a view, the CDJ plays it in exactly that order in its default browse screen.

Single-column sort vs compound sort

rekordbox and the CDJ-3000 / XDJ-1000MK2 can sort a list by key or BPM, never both at once. Given the same playlist, the three modes produce different orders:

Sort modeKey orderBPM within key group
Sort by Key (single column)✓ aligned✗ playlist registration order
Sort by BPM (single column)✗ scattered across the wheel✓ aligned, but key grouping is gone
Bake'n Deck Sort (key → BPM)✓ aligned✓ ascending

Three sorts, six tracks

Six tracks in a playlist. This is registration order, which is also the order stored in the playlist:

#TrackKeyBPM
1A1A130
2B2A124
3C1A124
4D2B130
5E2A128
6F2B124

The same six tracks, under each of the three sorts:

#Sort by KeySort by BPMBake'n Deck (key → BPM)
1A · 1A · 130C · 1A · 124C · 1A · 124
2C · 1A · 124B · 2A · 124A · 1A · 130
3B · 2A · 124F · 2B · 124B · 2A · 124
4E · 2A · 128E · 2A · 128E · 2A · 128
5D · 2B · 130A · 1A · 130F · 2B · 124
6F · 2B · 124D · 2B · 130D · 2B · 130

Sort by key and the BPM inside 1A and 2B runs 130 → 124, the opposite direction of a warm-up. Sort by BPM and the key walks 1A → 2A → 2B → 2A → 1A → 2B. Only the third column keeps the keys in order and the BPM rising inside each one.

The Sort screen in Bake'n Deck: the playlist list, and the sorted preview with Key and BPM columns
The order you are about to write, before anything is written

How to sort a rekordbox playlist by key and BPM

  1. Set the key display to Alphanumeric
    Preferences → View → Key display format → Alphanumeric (1A..12B). If your keys are not in Camelot notation, Sort stops without reordering anything and tells you which preference to change.
  2. Export your collection as XML
    File → Export Collection in xml format. Always save to the same path, for example ~/Music/rekordbox/collection.xml.
  3. Run Sort
    In the Mac app, pick the XML, check the resulting order on screen before anything is written, then Sort in Place. On the command line, baken rbsort collection.xml sorts every playlist in place.
  4. Point Imported Library at that file, once
    Preferences → Advanced → Database → rekordbox xml → Imported Library, and select the same file. This is a one-time setup.
  5. Restart rekordbox
    The rekordbox xml tree in the left sidebar becomes a sorted mirror of your Playlists.
  6. Export to USB
    Drag a playlist from the rekordbox xml tree into your Playlists, switch to EXPORT mode, right-click → Export Playlist. The CDJ plays it in that order.

Don't see it? The sorted playlists live only in the rekordbox xml tree, not in your main Playlists. Switch sidebar trees.

Terminal — rbsort
$ baken rbsort ~/Music/rekordbox/collection.xml
Sorted 12 playlists (1480 tracks) by Key+BPM → ~/Music/rekordbox/collection.xml

$ baken rbsort ~/Music/rekordbox/collection.xml --playlist "Sets/Friday"
Sorted 124 tracks in 'Sets/Friday' by Key+BPM → ~/Music/rekordbox/collection.xml

Sort rules

  • Primary: Camelot key ascending, 1A → 1B → 2A → 2B → … → 12A → 12B
  • Secondary: BPM ascending within each key group
  • Tracks with no Camelot key sort after all known keys; BPM 0 sorts last within a key group
  • The exported XML is sorted in place. Only the order of the track references changes; names, folders and every other byte are preserved, so re-running is a no-op
  • Your rekordbox library itself is never touched; the sorted playlists appear in the separate rekordbox xml tree

Frequently asked questions

Can rekordbox sort by key and BPM at the same time?

No. rekordbox and the players sort one column at a time. Sort by key and the BPMs inside each key stay in the order the tracks were added to the playlist. Getting both requires rewriting the order stored in the playlist rather than the order on screen.

Why are the BPMs scattered after I sort by key on the CDJ?

Because sorting on the player is a view. It never changes the order stored in the playlist, and the stored order is what the CDJ reads.

Does this modify my rekordbox library?

No. Your library is never touched. Only the track order inside the exported XML changes, and the sorted playlists appear in the separate rekordbox xml tree. Names and folder structure stay as they were.

Do cues and beatgrids survive?

Yes. Sort changes the order of the track references and nothing else. The audio files are not touched at all.

Is it free?

The baken CLI is free and MIT licensed for macOS, Windows and Linux. Bake'n Deck for Mac is a one-time purchase on the Mac App Store, with no subscription.

Get Sort

Bake'n Deck for Mac is on the Mac App Store. It shows the resulting order before anything is written and offers a re-sort whenever rekordbox exports the XML again. The baken CLI is free and MIT licensed.

Download on the Mac App Store

See all three tools →