Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 50 · Getting Started

The piano keyboard and pitch

Learn how the piano keyboard maps pitch: white and black keys, octaves and note numbers, half and whole steps, sharps, flats and enharmonic notes.

If the staff is a graph of pitch on paper, the piano keyboard is the same graph made of wood and ivory. Low notes are on the left, high notes are on the right, and every key is exactly one step from its neighbors. Even if you play the guitar, the violin or the voice, the keyboard is the best map for learning theory because you can see the distances between notes. A half step, a whole step, a scale: all of these are easier to grasp when you can point at them.

This lesson teaches how the keys are named, why some notes have two names, and how to count distances between notes. These are the ideas on which scales, chords and key signatures all rest.

Fourteen white keys from C3 to B4 with black keys in groups of two and three and middle C highlighted
The pattern of black keys in twos and threes is a built-in map: C is always just left of a group of two.

What you will learn

  • How to find any white key using the groups of two and three black keys
  • What an octave is and how octave numbers (C4, A4) label a specific pitch
  • What half steps and whole steps are
  • How sharps and flats name the black keys, and what enharmonic means
  • How to count the twelve different notes of the chromatic scale

Key terms

Octave: the distance between one note and the next note with the same letter name; the higher note vibrates at twice the frequency.

Half step (semitone): the distance between two neighboring keys, black or white, with none in between.

Whole step (tone): two half steps.

Sharp (♯) and flat (♭): signs that raise or lower a note by one half step.

Enharmonic: two names for the same pitch, such as C♯ and D♭.

Finding the white keys

A standard piano has 88 keys: 52 white and 36 black, running from A0 at the left to C8 at the right. White keys carry the seven letters A to G, and the same letters repeat from low to high. The black keys come in alternating groups of two and three, which is the map you use to find your way.

  • C is the white key just to the left of a group of two black keys. Every C on the keyboard is found this way.
  • F is the white key just to the left of a group of three black keys.
  • D is the white key in the middle of the group of two; E is the white key to the right of that group.
  • G and A sit among the group of three: G is between its first and second black keys, and A is between its second and third. B is the white key just right of the group, the last one before the next C.

Once you can find C and F, you can find every white key by counting letters up or down. Try it on a real keyboard or on the playable keyboard below: put your finger on a C, then say "C, D, E, F, G, A, B, C" as you move up the white keys.

Octaves and note numbers

The distance from one C to the next C is an octave. The notes sound alike because the higher note vibrates exactly twice as fast. A pitch with a given frequency has the same letter name at all its octaves, so letters alone are ambiguous: "play a C" could mean any of eight Cs on the keyboard. To name one exact note we add an octave number. The system used in this course, scientific pitch notation, numbers the octaves so that the C nearest the middle of the piano is C4. Octaves begin at C, so the octave runs from C4 up to B4, and then C5 starts the next one. That surprises many people: B4 is the highest note of the fourth octave, and the very next white key is C5.

  • Middle C is C4. On a standard piano it is the C closest to the center of the keyboard.
  • A4 is the A above middle C, with a frequency of 440 vibrations per second (440 Hz). It is the usual tuning reference.
  • The lowest piano key is A0, and the highest is C8.

Some books use other names: the Helmholtz system calls middle C "c′" and the C an octave lower "c". MIDI numbers count each key: middle C is MIDI note 60, A4 is 69. You will see all of these; we use letters with numbers because they are clear.

Half steps and whole steps

The smallest distance in the Western system is the half step (also called a semitone). On the piano it is the distance between any two keys that are neighbors, with no key between them. Two white keys can be neighbors (E and F, and B and C), or a white and a black key (C and the black key above it).

A whole step (tone) is two half steps, which skips exactly one key. From C to D is a whole step because the black key C♯/D♭ lies between them. From E to F is a half step because nothing lies between them.

Look at the keyboard picture and notice a surprising fact: there is no black key between E and F, and none between B and C. This asymmetry is the heart of the white-key scale. Seven white keys span an octave, but the distances between them are not all equal: five are whole steps and two are half steps. In order from C: whole, whole, half, whole, whole, whole, half. You will recognize this as the major scale in chapter 3.

Sharps, flats and the black keys

The black keys are named by modifying the white keys beside them.

  • A sharp (♯) raises a note by one half step. C♯ is the key just above C.
  • A flat (♭) lowers a note by one half step. D♭ is the key just below D.
  • A natural (♮) cancels a previous sharp or flat.

The black key between C and D can therefore be called C♯ (one half step above C) or D♭ (one half step below D). It is the same key, and so the same pitch. Two names for one pitch are called enharmonic equivalents. Which name you use depends on the key and the context of the music, as you will see in the lessons on key signatures.

One octave from C4 to C5 with each black key labeled with sharp and flat names and half step numbers above C
Counting half steps from C: white keys are 0, 2, 4, 5, 7, 9, 11 and 12; every black key fills a gap.

Counting all keys, white and black, from one C to the next gives twelve different notes before the pattern repeats (C, C♯, D, D♯, E, F, F♯, G, G♯, A, A♯, B). The pattern of twelve half steps is called the chromatic scale. Each of the twelve notes is called a pitch class: a pitch class groups every octave of the same note, so "all the Cs" are one pitch class.

White keys can also be sharps or flats, which surprises beginners. E♯ is the key one half step above E, and since there is no black key there, E♯ is the white key F. Likewise B♯ is C, F♭ is E, and C♭ is B. Such spellings are used when the key of a piece requires them, as you will see in chapter 3. There are even double sharps (×), which raise a note by two half steps, and double flats (♭♭), which lower it by two.

Common misconceptions

"Sharp means black key." A sharp raises a note by one half step; whether the result is a black or a white key depends on the starting note. E♯ and B♯ land on white keys.

"C♯ and D♭ are different notes." On a piano (and on any instrument tuned to equal temperament) they are the same pitch. Their names differ because they play different roles in the harmony.

"The octave contains eight notes, so it is eight half steps." The word comes from eight letter names (C to C counts C D E F G A B C). In half steps an octave is twelve.

Try it

This keyboard has black keys too. Click any key to hear it; its name appears above. Black keys show both names. Listen for what a half step sounds like by clicking E then F, and compare it with the whole step from F to G.

One octave of keys with sharp and flat names

Now let the computer do the naming. This Python program turns key numbers (MIDI numbers) into note names, once with sharps and once with flats, and also prints each key's frequency. Notice that the pitch is the same whichever name you choose.

Python MIDI numbers, names and frequencies

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

One more check on half steps and whole steps. This program starts on a note and walks up by a list of steps. Change the list to [2, 2, 1, 2, 2, 2, 1] and see the major scale appear (steps are counted in half steps; the numbers 2 and 1 mean whole step and half step).

JS Walk up the keyboard in steps

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check · 6 questions

of 6 answered You scored / 6 · perfect!

  1. 1. Which white key is found just to the left of a group of two black keys?

    C sits just left of the group of two black keys. F sits just left of the group of three.
  2. 2. How many half steps are in an octave?

    Counting every key, black and white, there are twelve half steps from one note to the next note with the same name.
  3. 3. Which pair of white keys are only a half step apart?

    There is no black key between E and F (or B and C), so these white keys are neighbors.
  4. 4. What does enharmonic mean?

    Enharmonic spellings name one pitch two ways. The choice depends on the key and context.
  5. 5. What is E sharp on the keyboard?

    E sharp is one half step above E. Since no black key sits between E and F, the result is F.
  6. 6. In scientific pitch notation, which note is middle C?

    Middle C is C4. A4, the tuning note, is 440 Hz.

Summary

  • The keyboard has white keys named A to G and black keys in groups of two and three; C is left of the group of two.
  • An octave is twelve half steps; the higher note vibrates twice as fast.
  • Octave numbers fix an exact pitch: middle C is C4, the A above is A4 at 440 Hz.
  • A half step is the distance between neighboring keys; a whole step is two half steps.
  • Sharps raise and flats lower a note by a half step; black keys have two names (enharmonic equivalents).
  • There are twelve different pitch classes in the chromatic scale.

Next: Reading notes, ledger lines and octaves