Major Key Signatures
As mentioned on the page on tonality, most musical compositions gravitate toward one primary pitch, which is called the key of that piece of music. If a composition is based on the notes of an E flat major scale, it is in the key of E flat major.
In written music, the key of a piece is represented by the key signature, which is a group of sharps or flats that are placed to the right of the clef. Using a key signature accomplishes two purposes: it indicates the key of the music, and it also takes the place of having to write every single accidental in front of notes. For example, if a piece of music has a key signature of G major (which has one sharp), then every time there is an F written in the music, it should be played as F sharp.
The images below show the key signatures for all major keys in treble and bass clefs. Note that each key signature will include either sharps or flats, but never both at the same time. Also, note that the order of sharps and flats is very specific and follows a definite pattern.
Major key signatures in treble clef
Major key signatures in bass clef