An accidental, in music theory, is a musical notation that is used to raise or lower the pitch of a note. There are a handful of accidentals - sharps, flats, naturals, double sharps, and double flats. In piano, when an accidental precedes a note, it tells the pianist to play a different note from the original. When an accidental appears in a measure, every note that is the same as the note being changed is changed the same way. In a key signature, accidentals retain their effects for the entire piece (unless a natural has been used to cancel it).
A sharp raises the note by a half-step (or one key precisely to the right of the note being raised). They can written as #. A sharp does not necessarily mean a black key as sharps raise a note by a semitone, whether if it is a black or white key. An example of a sharp: B sharp sounds the same as, or is enharmonically equivalent to a C natural. G sharp becomes an A flat and so on.
A flat lowers the note by a half-step (or one key precisely to the left of the note being lowered). They can be written as b. Flats also do not mean the presence of a black key as e of all flats lower a note by a semitone, regardless if it is a black or white key. An example of a flat: C flat is enharmonically equivalent to B natural. G flat sounds the samed as F sharp.
Naturals are used to cancel the effects of any accidental.
Double sharps raise the affected note by a whole-step (or two keys precisely to the right of the affected note).
Double flats lower the affected note by a whole-step (or two keys precisely to the left of the affected note).
To remember the order of the flats or the sharps, keep in mind these mnemonics:
For the order of the flats: Battle Ends And Down Goes Charles' Father
For the order of the sharps: Father Charles Goes Down And Ends Battle