Why does equal temperament allow music to be played in different keys?
Equal temperament allows music to be played in any key because it divides the octave into 12 semitones of exactly equal size.12
In earlier tuning systems, such as just intonation or meantone temperament, intervals were calculated using pure, natural ratios. These systems were "cyclic," meaning they accumulated intonational errors as they moved into keys with more sharps or flats. Consequently, an instrument tuned to sound perfect in C major would sound increasingly out of tune when transposed to keys like B major, as the actual interval sizes would change.1
By contrast, equal temperament distributes small intonational defects equally across all 12 tones of the chromatic scale. Because the intervals are identical regardless of the starting note, the system provides enharmonic equivalence—treating notes like F♯ and G♭ as the same—which enables keyboard instruments to play in all major and minor keys without the "wolf" intervals or severe dissonance found in older systems.12