In Western musical notation, a key signature is a set of sharp (♯), flat (♭), or rarely, natural (♮) symbols placed on the staff at the beginning of a section of music. The initial key signature in a piece is placed immediately after the clef at the beginning of the first line. If the piece contains a section in a different key, the new key signature is placed at the beginning of that section.
In a key signature, a sharp or flat symbol on a line or space of the staff indicates that the note represented by that line or space is to be played a semitone higher (sharp) or lower (flat) than it would otherwise be played. This applies through the rest of the piece or until another key signature appears. Each symbol applies to comparable notes in all octaves—for example, a flat on the fourth space of the treble staff (as in the diagram) indicates that all notes notated as Es are played as E-flats, including those on the bottom line of the staff.