In music notation, the key signature is a series of sharps, flats, and/or natural signs at the beginning of a staff following the clef (but before the time signature). It indicates what major key the music is to be played in. If the song is in a minor or diminished key, the key signature may use natural symbols where certain sharp or flat symbols would be for the equivalent major key. Like the clef, but unlike the time signature, the key signature reappears on every staff line.

The sharps or flats in the key signature are to be carried through the entire piece as the "default" for that note. If a key signature lists F sharp and C sharp, for example, then any time an F or C is encountered on the staff it should be interpreted as F sharp or C sharp instead. A key signature can be changed in the middle of a piece, and if so, the new key signature is used at the beginning of each staff after that point.

The sharp or flat symbols in a major key signature are always arranged in a certain order, sometimes known as the circle of fifths. If sharps are used, this order is: F, C, G, D, A, E, B. If flats are used, the order is: B, E, A, D, G, C, F.

A key signature (A major in this case) looks something like this on the staff:


     /\                                               
----| /----#-----------------------------------------------
    |/                                                    
----/------------------------------------------------------
   /|    #                                                 
--/-|/\----------------------------------------------------
 |  |  |                                                   
-|--|--|----#----------------------------------------------
  \ |  |                                               
---\|_/----------------------------------------------------
    |                                                  
   \|