Virtual Piano

Play a piano keyboard in your browser with your mouse or computer keys, with note names and the layout explained.

Click keys or use your keyboard (A–L row). Full-88 mode scrolls sideways.

Fifty-two white keys, thirty-six black

The full keyboard above runs A0 to C8 — 88 keys spanning 27.5 Hz to 4186 Hz, a little over seven octaves. 52 of them are white and 36 black, which is 59% to 41% — not a split anyone would choose from scratch for a scale of twelve equal steps.

The reason is that the white keys are not evenly spaced:

C-DD-EE-FF-GG-AA-BB-C
2 semitones 2 semitones 1 semitone 2 semitones 2 semitones 2 semitones 1 semitone

2 of the 7 are semitones, at E-F and B-C — exactly where no black key sits. Play only the white keys and you are not playing an even scale; you are playing a pattern with two of its gaps missing.

That irregularity is the whole reason the layout works. The black keys are not contiguous in pitch — C♯ and D♯ have D between them — but splitting the octave at those two semitone gaps groups them 2 then 3, and that grouping gives every octave a landmark. A uniform row of twelve identical keys would be impossible to navigate by touch, because every position would look like every other. The keyboard is easy to use because the scale it displays is uneven, and a fairer layout would be worse.

And one interval has two right answers

Every key here is a fixed number of equal steps from every other, so asking how far out of tune an interval is means comparing it against a whole-number ratio. For most intervals there is one obvious candidate. For the minor seventh there are two in common use:

RatioValueWhere it comes fromTempered seventh is
16/9 1.777778 the inversion of the major second 3.91 cents sharp
9/5 1.800000 a fifth stacked on a minor third 17.60 cents flat

They differ by 81/80 — the syntonic comma, 21.51 cents. Same key, same frequency (1.781797 times the root), and the answer to "how out of tune is this" swings by 21.51 cents — more than a fifth of a semitone — depending which ratio the person asking had in mind. The two do not even agree on the direction.

The tidy way to choose is to require that an interval and its inversion multiply to an octave, since together they span one. The major second is 9/8, and 9/8 × 16/9 = 2.0000 exactly, while 9/8 × 9/5 = 2.0250. Every other interval pair mirrors cleanly; the minor seventh is the only one where the choice is live. It is a useful reminder that "out of tune by N cents" is a statement about two things rather than one.

Why equal temperament exists at all, and what it costs every other interval, is worked out on the guitar tuner.

How to use

  1. Click keys, or use the mapped computer keyboard.
  2. Turn on note names if you are learning the layout.
  3. Use it for reference and ear training rather than technique.
  4. Learn on a weighted keyboard if you are serious.

Frequently asked questions

Why are the black keys grouped in twos and threes?

So you can find your place without looking. The pattern makes every note identifiable by touch — C is always immediately left of a group of two black keys — which is what lets pianists navigate a uniform-looking keyboard without counting from the end.

Can I learn piano on a computer keyboard?

For note names, intervals, chord shapes and ear training, usefully. For technique, no — a computer keyboard has no weight, no velocity sensitivity and the wrong geometry, so it teaches nothing about touch, dynamics or hand position. It is a reference instrument rather than a practice one.

What is the difference between weighted and unweighted keys?

Weighted keys simulate the resistance of a real piano action, which is what builds the finger strength and control that transfer to an acoustic instrument. Unweighted keys are lighter, cheaper and fine for organ or synthesiser sounds, but a student who learns only on them finds a real piano hard work.

How many keys does a piano have?

Eighty-eight on a standard modern instrument, spanning just over seven octaves. Earlier pianos had considerably fewer, which is why some older repertoire never uses the extremes — the notes simply did not exist when it was written.

What is middle C?

The C nearest the middle of the keyboard, sitting just below the treble clef and just above the bass clef. It is the reference point both clefs are built around, which is why it is the first note most people learn to locate.

Does this work on a phone?

It plays, though a small touchscreen makes chords awkward and there is no velocity sensitivity. A larger screen is considerably more usable, and a real MIDI keyboard connected to the browser is better again if you have one.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.