Understand the Pattern of Black Piano Keys

Why are there only 5 black piano keys per octave?

Piano accidentals.
It looks like some white keys are missing an accidental. Brandy Kraemer

Most people are familiar with the appearance of piano keys; alternating white and black keys sprawl across keyboards. When looking closely, have you ever noticed that there are fewer black piano keys than white piano keys? To understand the pattern of black keys on a piano, it is important to be familiar with notes and their sharps and flats

The white keys on a piano are notes that are in their natural state.

That is, the pitch is unaltered, such as a C or an A. When a note is raised by a half step by adding a sharp or flat accidental, the key that often corresponds to the accidental is a black key — which is a half step away from its neighboring white key. Each note on the piano can have a sharp or a flat, but there are fewer black piano keys than white ones. This means that not every sharp or flat note is played on a black key. Some sharps, such as B♯ are played on a white key because C (B♯) is a half step higher than B

There are a total of seven notes in a musical scale, on which the piano keyboard is based.  The concept of the seven-note scale originated in early music and was based on a system of modes. Without getting too technical, understanding a major scale's interval pattern can help you detect when the black notes come in handy. A scale has intervals of whole steps and half steps in a specific pattern.

Look at the image above: The C appears to have no flat because there is no black key directly to its left. But C does have a flat, it’s just disguised as B. In C major, the half steps fall between B-C, and E-F. Since there is already a half step between these notes, adding a black key – which lowers a note by a half step – would be unnecessary.The pattern of the C major scale is as follows:

C (whole step)  D (whole step) E (half step) F (whole step) G (whole step) A (whole step) B (half step) C 

Every major scale follows the same pattern of steps in this sequence: whole - whole - half - whole - whole - whole - half (W-W-H-W-W-W-H). In C major, that pattern results in all white keys.

What if you start a major scale on a different note, say D? You'll need to use black keys for some of your half steps in the pattern, specifically F and C♯.

Without the black piano keys, it would be very hard for our eyes and fingers to distinguish landmarks on the piano. Black keys help to guide us so that we can easily find the half step patterns that are regularly played in music.

Tip: The B note (along with B chords and key signatures) can also be written as C flat. Its name simply depends on the key signature. These notes are examples of enharmony.