In Western musical notation, a key signature is a group of sharp (♯), flat (♭), or rarely, natural (♮) symbols placed on the staff at the start of a section of music. The first key signature in a piece is placed right after the clef at the beginning of the first line. If a piece has a section in a different key, the new key signature is placed at the start of that section.
In a key signature, a sharp or flat symbol on a line or space of the staff shows that the note on that line or space should be played a semitone higher (sharp) or lower (flat) than usual. This rule applies for the rest of the piece or until another key signature is used. Each symbol affects the same note in every octave—for example, a flat on the fourth space of the treble staff (as shown in the diagram) means all notes written as E are played as E-flat, including those on the bottom line of the staff.
Most of this article discusses key signatures that represent the standard keys of Western music. These key signatures use either flats or sharps, but not both, and they add flats or sharps in the order shown in the circle of fifths.
Each major and minor key has a key signature that shows up to seven flats or seven sharps. This indicates the notes used in its scale. Sometimes, music was written with a key signature that did not match its key, as seen in some Baroque pieces or transcriptions of traditional modal folk tunes.
Overview
A major scale is created by following a specific pattern of intervals: whole step, whole step, half step, whole step, whole step, whole step, and half step. Starting on the note C, this pattern produces the C-major scale: C-D-E-F-G-A-B-C. This scale has no sharps or flats, so the key signature for C major includes no sharps or flats. When starting on a different note, at least one note in the scale must be raised or lowered to keep the major scale pattern. These changes form the key signature. For example, starting on D creates the D-major scale: D-E-F♯-G-A-B-C♯-D. This scale has two sharps, F♯ and C♯, so the key signature for D major includes these two sharps.
Key signatures show musicians which key the music is in, so they do not need to write accidentals (sharps or flats) for individual notes. In standard music notation, sharps or flats in key signatures always appear in the same order, following the circle of fifths. Sharps are listed as F♯, C♯, G♯, D♯, A♯, E♯, B♯. Flats are listed as B♭, E♭, A♭, D♭, G♭, C♭, F♭. Musicians can identify the key by counting the number of sharps or flats, as they always follow this order. For example, a key signature with one sharp must show F♯, which means the key is either G major or E minor.
Some modern music, especially from the 20th century, may use unusual scales or invented key signatures that do not follow the standard order of sharps or flats. These might include combinations like F♯ and B♭. Composers such as Béla Bartók sometimes used these types of key signatures.
In musical scores, transposing instruments (instruments that play a different pitch than written) show a different key signature to reflect their transposition, but their music is still in the same concert key as other instruments. Percussion instruments that do not have fixed pitches, such as timpani, often do not use key signatures. Early timpani parts sometimes showed the high drum as "C" and the low drum as "G," with actual pitches written at the start of the music. In polytonal music, where different parts use different keys at the same time, instruments may be written in different keys.
Conventions
The order of sharps or flats in key signatures is shown in the circle of fifths diagram. Starting the major scale pattern (whole step, whole, half, whole, whole, whole, half) on C requires no sharps or flats. Moving clockwise in the diagram begins the scale a fifth higher, on G. Starting on G needs one sharp, F♯, to form a major scale. Moving another fifth higher, on D, requires F♯ and C♯. This pattern continues, adding one sharp to the seventh scale degree of each key. When scales use flats, one flat is removed. This is a notation rule—the seventh scale degree is still raised by a semitone compared to the previous key. Moving counter-clockwise from C lowers the fourth scale degree with each key (starting on F requires a B♭ to form a major scale). Each major key has a relative minor key with the same key signature. The relative minor is always a minor third lower than its major key.
Key signatures with seven sharps or seven flats are usually written as their enharmonic equivalents. C♯ major (seven sharps) is often written as D♭ major (five flats), and C♭ major is usually written as B major.
A key signature can change at any time in a piece by showing a new signature. If the new signature has no sharps or flats, a signature of naturals is used to cancel the previous one. If a change happens at the start of a new line, the new signature is usually repeated at the end of the previous line to make the change clear.
When a key signature changes from sharps to flats or vice versa, the old signature can be canceled with a matching set of naturals before the new one is shown. This was common in older music but is less frequent in newer music. Naturals are still needed if the new key has no sharps or flats (C major, A minor, or an open key).
If a flat key changes to fewer flats or a sharp key changes to fewer sharps, the old convention used naturals to cancel the removed flats or sharps. Modern music often skips the naturals unless the new key has no sharps or flats.
When a flat key changes to more flats or a sharp key changes to more sharps, the new signature is written directly without canceling the old one. This applies to both traditional and modern notation.
In the past, a double barline was often used before a new key signature, but now a single barline is more common. A courtesy signature at the end of a line before a change is usually preceded by an extra barline, and the last line of the staff is often omitted.
If naturals and a new key signature appear together at a change, modern scores sometimes place the barline after the naturals but before the new signature. Previously, all symbols were placed after the barline.
The A♯, the fifth sharp in key signatures, may occasionally appear on the top line of the bass staff, though it is more commonly found in the lowest space of that staff. An example is in the bass parts of Respighi’s Pines of Rome, in the section "Pines of the Janiculum" (B major).
The final F♭ in seven-flat key signatures may sometimes be written on the second-top line of the bass staff, though it is more often placed below the staff. An example is in Albéniz’s Iberia, first movement, "Evocación" (A♭ minor).
Key signatures can include double flats or double sharps, but this is very rare. For example, G♯ major would require eight sharps, including an F double-sharp. However, A♭ major (four flats) is usually used instead. Key signatures with more than one or two double flats or sharps are hard to read and are replaced by enharmonic equivalents.
A piece in a major key may modulate up a fifth to the dominant, adding a sharp to the key signature. For example, moving from C♯ major to G♯ major (eight sharps) could be notated as A♭ major (four flats) instead. This is seen in Debussy’s Suite bergamasque, where sections in D♭ major or G♯ major are written using enharmonic equivalents.
Some passages use double sharps or flats instead of enharmonic equivalents. For example, G♯ major is written in Bach’s Well-Tempered Clavier.
Key signatures with double sharps or flats are rare. Examples include Foulds’ A World Requiem (G♯ major), Reicha’s Practische Beispiele (B♯ major), and Ewald’s Brass Quintet (F♭ major).
There is no standard way to notate these key signatures:
– LilyPond (and A World Requiem) lists single sharps/flats first, then double signs.
– Some scores, like Reger’s Supplement to the Theory of Modulation, repeat single signs at the end.
– Others, like Ewald’s works, place double signs first, followed by single signs.
– Reicha’s Practische Beispiele in B♯ major lists B♯, E♯, A♯, D♯, G♯, C♯, F♯.
In tuning systems with notes per octave that are not multiples of 12, notes like G♯ and A♭ are not enharmonically equivalent. These systems may require double sharps, double flats, or microtonal alterations in key signatures. For example, G♯ major (eight sharps) is equivalent to A♭ major in 12-tone equal temperament but to A major (11 flats) in 19-tone equal temperament.
Major scale structure
A key signature can have up to seven sharps. These sharps appear in this order: F♯, C♯, G♯, D♯, A♯, E♯, B♯. The tonic (main note) of a major key is a semitone above the last sharp in the key signature. For example, the key of D major has two sharps: F♯ and C♯. The tonic, D, is a semitone above the last sharp, C♯. Each new major scale begins on the fifth note of the previous scale and adds one new sharp in the order listed.
A key signature can also have up to seven flats. These flats are listed in this order: B♭, E♭, A♭, D♭, G♭, C♭, F♭. The major key with one flat is F major. In major keys with more than one flat, the tonic is a perfect fourth below the last flat in the key signature. When there are multiple flats, the tonic is the note of the second-to-last flat. For example, in the key with four flats (B♭, E♭, A♭, D♭), the second-to-last flat is A♭, which means the key is A♭ major. Each new major scale begins a fifth below (or a fourth above) the previous scale.
Relationship between key and signature
In diatonic or tonal music, the sharps or flats needed to create a diatonic scale are shown as a key signature at the start of a musical section instead of using accidentals on individual notes. Usually, the key of a piece matches the key signature, but this may not always be true. For example, in music from before the Baroque period, the modern idea of keys had not yet developed fully.
Some musical pieces include modulations, which are changes in key between different sections. These modulations might or might not be shown by changing the key signature. Instead, modulated sections may use accidentals to indicate the new key.
The Toccata and Fugue in D minor, BWV 538 by Bach, has a key signature with no sharps or flats. This suggests the piece might be in the key of D or the Dorian mode. However, the B♭ notes shown with accidentals confirm the music is in D minor.
Keys that share the same key signature are called relative keys.
The note that is one step above the tonic is called the supertonic.
When musical modes, such as Lydian or Dorian, are written using key signatures, they are referred to as transposed modes.
Use in other traditions
Key signatures are used in music that is not from the Western common practice period. This includes folk music, non-Western music, and Western music from before or after the common practice period.
Klezmer music uses scales other than the standard major or minor scales, such as the Phrygian dominant scale. Because the Great Highland Bagpipe scale cannot play certain notes, key signatures are often left out in written pipe music. This music would normally be written with two sharps, F♯ and C♯, but the pipes cannot play F♮ or C♮, so the sharps are not written. In the 20th century, composers like Bartók and Rzewski experimented with key signatures that are not based on the standard major or minor scales.
In music from the Baroque period, key signatures sometimes use a different order of notes than modern practice, or the same note-letter is used for each octave.
There are 15 key signatures that form standard diatonic scales. Other scales are written using a standard key signature with additional accidentals, or with a nonstandard key signature. Examples include the E♭ (right hand) and F♯ and G♯ (left hand) used for the C diminished (octatonic) scale in Bartók’s Crossed Hands; the B♭, E♭, and F♯ used for the D Phrygian dominant scale in Frederic Rzewski’s God to a Hungry Child; and the E♭ and D♭ (right hand) and B♭, A♭, G♭ (left hand) in György Ligeti’s Galamb Borong, and B♭, E♭, D♭, G♭ (both hands) in Pour Irina.
Some music uses conflicting key signatures, such as:
– No. 3 of Sergei Prokofiev’s Sarcasms, Op. 17 (three sharps in the right hand and five flats in the left hand).
– Four pieces from Ligeti’s Études pour piano: No. 1 from the first book (no sharps or flats in the right hand and five sharps in the left hand); No. 10 from the second book (Der Zauberlehrling; no sharps or flats in the right hand and five flats in the left hand in bars 67–87); No. 11 from the second book (En Suspens; five flats in the right hand and none in the left hand, with the opposite later on); No. 12 from the second book (Entrelacs; none in the right hand and five flats in the left hand, with the opposite later on).
A key signature with no sharps or flats can mean the music is in the key of C major/A minor, or that the piece is modal (uses scales other than major or minor) or atonal (does not follow a specific key). An example is Bartók’s Piano Sonata, which has no fixed key and uses many different notes.
History
During the Medieval period, key signatures with one flat were used. However, key signatures with more than one flat were not used until the 16th century. Key signatures with sharps were not used until the mid-17th century.
When key signatures with multiple flats were first introduced, the order of the flats was not standardized. Sometimes, a flat was shown in two different octaves. In the late 15th and early 16th centuries, different voice parts in the same composition often had different key signatures. This situation was known as a partial or conflicting key signature. This was more common than using complete key signatures in the 15th century. An example is the 16th-century motet Absolon fili mi by Pierre de La Rue (once thought to be by Josquin des Prez), which includes two voice parts with two flats, one part with three flats, and one part with four flats.
Baroque music in minor keys was often written with fewer flats than modern key signatures. For example, pieces in C minor sometimes used only two flats because the A flat was often raised to A natural in the ascending melodic minor scale, as was the B flat.