Table of key signatures.
Major and minor key signatures.
The key signature is a series of sharp (♯) or flat (♭) symbols placed on the stave, between the clef and the time signature, which shows the notes that have to be consistently raised or lowered by a semitone, unless signified otherwise by an accidental. A key signature is either made up of sharps or flats, but never a mixture of both. The key signature indicates the key in which the piece of music is to be played; for example, a key signature consisting of just a single F♯ indicates that the key is G major (or its relative minor, E minor). If the key changes partway through, then so does the key signature. If a key signature is changed in a piece of music a double bar line occurs, followed by the new key signature.
The key of C major is the simplest because it contains no sharps or flats at all (see major scale). The next simplest are G major (one sharp) and F major (one flat). Starting from C major we can generate all the other major scales. Take the fifth note (the dominant) of C major, G. and make it the first note of the new scale, G major. In order to maintain the standard step-pattern of the major scale, the 7th ("leading") note of the new scale must be raised by a semitone. This note is F – the fourth (subdominant) note in the scale of C major – and it must be raised to F#. The rule is therefore this: the 5th note of any scale can be used to start a new scale in which only one note need be raised, this being the 4th note of the old scale, which becomes the 7th note of the new scale.
Now consider the keys that have flats in their key signature. To get the scale of F major starting from C major, start the new scale from the 4th (sub-dominant) note of C major (F). This time to maintain the major scale pattern of tones and semitones, the 7th note (B) has to be flattened, thus becoming B♭. Continuing on, take the 4th note of F major, B, and make this the first note of the next scale (B major) and flatten the 7th (E), becoming E♭, and so forth.
Major and minor key signatures
In the illustration below, the white note in each case represents the major key, the black note the minor key with the same signature, called the relative minor. Starting from C, the keynotes of the sharp keys rise five notes (a perfect fifth) each remove, and the keynotes of the flat keys fall five notes (a perfect fifth) each remove. In the sharp major keys the keynote is immediately above the last sharp. In the flat major keys the keynote is four notes below the last flat (i.e. is at the pitch of the last flat but one in the signature). Three notes down any major scale we come to the keynote of its relative minor or, to state it the other way, three notes up any minor scale we come to the keynote of its relative major.
Keys with six sharps (F sharp major and D sharp minor) are (on keyboard instruments) the equivalents of the keys with six flats (G flat major and E flat minor), and that keys with seven sharps (C sharp major and A sharp minor) are the equivalents of the keys with five flats (D flat major or B flat minor). Composers use either one or the other of these signatures.
The order of the sharps in the signatures is by rising fifths, and the order of the flats by rising fourths:
Sharps ---> F C G D A E B <--- Flats
That is, the one order is the other reversed.