In musical notation, a key signature is a series of sharp or flat symbols placed on the staff, designating notes that are to be consistently played one semitone higher or lower than the equivalent natural notes unless otherwise altered with an accidental. Key signatures are generally written immediately after the clef at the beginning of a line of musical notation, although they can appear in other parts of a score, notably after a double bar.
Key signatures are generally used in a score to avoid the complication of having sharp or flat symbols on every instance of certain notes. Each major and minor key has an associated key signature that sharpens or flattens the notes which are used its scale. However, it is not uncommon for a piece to be written with a key signature that does not match its key, for example, in some Baroque pieces, or in transcriptions of traditional modal folk tunes.
Here is a B major scale written with notes:
and here is the same scale (played on the same notes) written using a key signature:
The purpose of the key signature is to minimize the number of accidentals required to notate the music. In principle, any piece can be written with any key signature, using accidentals to correct any notes where it shouldn't apply.
The effect of a key signature continues throughout a piece or movement, unless explicitly canceled by another key signature. For example, if a five-sharp key signature is placed at the beginning of a piece, every A in the piece in any octave will be played as A sharp, unless preceded by an accidental (for instance, the A in the above scale — the penultimate note — is played as an A even though the A in the key signature is written an octave lower).
The sequence of sharps or flats in key signatures is generally rigid in music from the common practice period. For example, if a key signature has only one sharp, it must be an F sharp; the complete order is set out below. Exceptions may be found in Klezmer scales, such as Freygish (Phrygian). In the 20th century composers such as Bartók and Rzewski (see below) began experimenting with unusual key signatures that departed from the standard order. The "standard" circle of fifths sequence is so firmly established that some musical notation programs are unable to show other key signatures.
In a score containing more than one instrument, all the instruments are usually written with the same key signature. Exceptions:
For a given musical mode the key signature defines the diatonic scale that a piece of music uses. Most scales require that some notes be consistently sharped or flatted. For example, the only sharp in the G major scale is F sharp, so the key signature associated with the G major key is the one-sharp key signature. However, the connection is not absolute; a piece with a one-sharp key signature is not necessarily in the key of G major, and likewise, a piece in G major may not always be written with a one-sharp key signature. This is particularly true of minor keys. Keys which are associated with the same key signature are called relative keys.
The famous "Dorian" Toccata and Fugue by Bach is so named because, although it is in D minor, there is no key signature, implying that it is in the key of C. Instead, the B flats necessary for D minor are written as accidentals. When musical modes, such as Lydian or Dorian, are written using key signatures, they are called transposed modes.
The use of a one-flat signature developed in the Medieval period, but signatures with more than one flat did not appear until the 16th century, and signatures with sharps not until the mid-17th century.
When signatures with multiple flats first came in, the order of the flats was not standardized, and often a flat appeared in two different octaves, as shown at right. In the late 1400s and early 1500s it was common for different voice parts in the same composition to have different signatures, a situation called a partial signature or conflicting signature. This was actually more common than complete signatures in the 15th century. The 16th-century motet "Absolon fili mi" attributed to Josquin Desprez features two voice parts with two flats, one part with three flats, and one part with four flats.
Baroque music written in minor keys often was written with a key signature with fewer flats than we now associate with their keys; for example, movements in C minor often had only two flats (because the A would frequently have to be sharpened to A natural in the ascending melodic minor scale, as would the B).
Alternatively, starting from C major, each sharp raises the key by a fifth, and each flat lowers it by a fifth (or, equivalently, raises it by a fourth). See the "Major Key" columns in the table.
The relative minor is a minor third down from the major, regardless of whether it is a "flat" or a "sharp" key signature.
For key signatures with sharps, the first sharp is placed on F line (for the key of G major/E minor). Subsequent additional sharps are added on C, G, D, A, E and B. For key signatures with flats, the first flat is placed on the B line, with subsequent flats on E, A, D, G, C and F. A common mnemonic for remembering this is Father Charles Goes Down And Ends Battle for key signatures with sharps, and vice versa for key signatures with flats: Battle Ends And Down Goes Charles' Father or Father Christmas Gave Dad An Electric Blanket. And Blanket Exploded And Dad Got Cold Feet respectively. There are 15 possible different key signatures, including the "empty" signature of C major/A minor. This sequence is rendered in the circle of fifths.
The key signatures with seven flats and seven sharps are very rarely used, not only because pieces in these "extreme" sharp or flat keys are more difficult to play on most instruments, but also because they have simpler enharmonic equivalents. For example, the key of C major (seven sharps) is more simply represented as D major (five flats). For modern practical purposes these keys are the same, because C and D are the same note. Pieces are written in these "extreme" sharp or flat keys, however: for example, Bach's Prelude and Fugue No. 3 from Book 1 of The Well-Tempered Clavier BWV 848 is in C major.
However, the aforementioned 15 key signatures only express diatonic scales (and are therefore sometimes called "standard key signatures"). Other scales are written either with a standard key signature and use accidentals as required, or with a non-standard key signature, such as the E (right hand) and F & G (left hand) used for the E diminished (E octatonic) scale in Bartók's "Crossed Hands" (no. 99, vol. 4, Mikrokosmos), or the B, E & F used for the D Phrygian dominant scale in Frederic Rzewski's God to a Hungry Child.
Note that an absence of a key signature does not always mean that the music is in the key of C major or A minor: each accidental may be notated explicitly as required, or the piece may be modal or atonal.
|Key Sig.||Major key||Minor key|
no sharps or flats
|C major||A minor|
|Key Sig.||Added||Major key||Minor key|
|B||F major||D minor|
|E||B major||G minor|
|A||E major||C minor|
|D||A major||F minor|
|G||D major||B minor|
|C||G major||E minor|
|F||C major||A minor|
|Key Sig.||Added||Major key||Minor key|
|F||G major||E minor|
|C||D major||B minor|
|G||A major||F minor|
|D||E major||C minor|
|A||B major||G minor|
|E||F major||D minor|
|B||C major||A minor|