Find the key of a song
Drop a track and get its key, the runner-up, the Camelot code DJs mix by, how far it is tuned from A = 440 and its tempo. The analysis runs in your tab, so an unreleased demo never leaves your computer.
drop a track here
or click to pick. MP3, WAV, M4A, FLAC, OGG and video files all work.
| Tempo | — |
|---|---|
| Tuning | — |
| Length | — |
| Mixes well with |
How it finds the key
A key is a set of seven notes, one of which feels like home. A song in A minor spends most of its time on A, C, D, E, F, G and B, lands on A at the ends of phrases, and hardly touches C# or F#. So the page listens for which of the twelve notes are sounding, summed over the whole track regardless of octave, and draws that as the bar chart above. That summary is called a chromagram. It is then compared with the shape each of the 24 major and minor keys is known to have: which notes turn up how often in real music, from David Temperley's statistical study of which notes appear, and how often, in real pieces. The best match wins, and the second-best is shown beside it.
Three details do most of the work. Only the peaks in the spectrum are counted, at their exact frequency, so a kick drum's broad thump does not vote for every note at once. The tuning is measured first and taken out, because a band tuned a third of a semitone sharp otherwise splits every note between two bars. And each moment of the song is weighed equally, so one loud chorus does not outvote the verses.
What was measured
Every release is checked against synthesized music in all 24 keys. Each fixture is eight seconds of bass, chords and melody in harmonic tones, which have overtones the way real instruments do. Each is played clean, with a drum kit and a noise floor added, and tuned 30 cents sharp. All 72 come out as the right key, and the tuning reads within 5 cents of what it was built with. Temperley's profiles and Krumhansl's older ones both got all 72 right, but Temperley's won by a wider margin, so that is what the page uses.
A real recording is harder. Beethoven's Sixth Symphony is in F major, but its first movement spends long stretches in C major, the key a fifth above. Given only the first minute, the page reads F major, with C major as the runner-up. Given the first four minutes, it reads C major. Both answers describe what is sounding. A song that changes key gets one answer for its whole length, so when that matters, cut out the section you care about with the cutter and analyse just that.
To get a figure for real recordings, the page was run on all 48 preludes and fugues of Book 1 of Bach's Well-Tempered Clavier, in Kimiko Ishizaka's public-domain piano recording. There are two pieces in every major and minor key, and each piece's key is in its title. It named the key in the title for 41 of the 48 (85%), and for six of the other seven the right key was the runner-up. The confidence line means something: the 36 readings it called clear were right 35 times. The misses were mostly a fifth away (G major read as D major, F minor as C minor), which is where a fugue spends its middle, and twice the wrong mode on the right note. That is one composer on one instrument, so treat it as a real-world figure, not a promise for every genre.
Major or minor: the one it gets wrong
Every major key has a relative minor with exactly the same notes: C major and A minor, G major and E minor. What tells them apart is which note the music treats as home, and that is far subtler than which notes are present. The check measures this case too. A loop of A minor, F, C and G, the most common chord loop in pop, uses only the notes of C major. In all 12 keys it read as the relative major, and in 11 of them the minor key was the runner-up. So if the answer is a major key and the song sounds sad, the alternative button is probably right. For DJs this matters less than it seems: relative keys share a Camelot number (C major is 8B, A minor is 8A), and they mix together cleanly either way.
Camelot codes and harmonic mixing
The Camelot wheel numbers the keys 1 to 12 round a circle of fifths, with A for minor and B for major. Two tracks mix without clashing when their codes are the same, one number apart in the same letter, or the same number in the other letter. The page lists those neighbours under the result. It is the system Mixed In Key popularised, and most DJ software can show keys in a code like it.
Tuning and odd pitches
The tuning figure says how far the recording sits from standard pitch, in cents: a hundredth of a semitone. Most modern productions read within a few cents of zero. A vinyl rip from a turntable running slightly fast reads sharp, a band that tunes to A = 432 Hz reads about −32 cents, and an old recording transferred from tape can be anywhere. None of this changes the key name. It does matter if you are going to play along or layer another sample on top.
When it cannot help
Drums on their own, speech and sound effects have no key, and the page will still name one, so the confidence line says when the reading is weak. Modal music is named by its relative major or minor: a song in D Dorian reads as C major or D minor, because those are the only two shapes the model knows. Heavy distortion adds overtones on every note and blurs the chart. And very old or detuned recordings can land between two keys. For vocals, pulling the instrumental out first with the stem splitter often gives a cleaner read, since a voice slides between notes and the chords do not.
What to do with the key
Singers usually want a song in a different key, and the key changer moves it by semitones without changing the tempo. It shows you which key each shift lands in. Producers matching a sample to a project can shift it the same way, then set its tempo with the speed tool. Autotune needs to know the key before it can snap a vocal to it, and the button under the result opens it with the key already chosen. The tempo shown here comes from the same detector as the BPM finder.
FAQ
Is my song uploaded anywhere?
No. Decoding and analysis both run in your browser tab. You can load the page, go offline and still get a key.
How accurate is it?
On synthesized music in all 24 keys, played clean, over drums and noise, and tuned 30 cents sharp, it named all 72 correctly. On real piano recordings of Bach's 48 preludes and fugues in Book 1 of the Well-Tempered Clavier, it named the key in the title for 41 (85%), and the right key was the runner-up for six of the other seven. When it said the reading was clear, it was right 35 times out of 36.
It says C major but the song sounds minor. Which is right?
Probably A minor, the alternative. C major and A minor use the same seven notes, and a minor-key pop loop like Am–F–C–G read as the relative major in every key tested. Click the alternative to switch the result.
What is the Camelot code?
A number from 1 to 12 plus A for minor or B for major, arranged round the circle of fifths. Tracks with the same code, a neighbouring number, or the same number in the other letter mix together without clashing.
Does it work on a song that changes key?
It gives one key for the whole file, whichever the music spends most time in. Cut out the section you care about and analyse that on its own.
What does the tuning number mean?
How far the recording is from A = 440 Hz, in hundredths of a semitone. A song tuned to 432 Hz reads about −32 cents; a vinyl rip on a fast turntable reads sharp.
Does it find the tempo too?
Yes, with the same detector as the BPM finder. If there is no steady beat, it says so instead of guessing.
How long can the file be?
Any length that your browser can decode, but only the first four minutes are read. That is plenty for a song and keeps the analysis to a few seconds.