Virtual Piano

Play a full piano keyboard with your mouse, touch screen or computer keyboard.

runs in-browser
Computer keys start at C3

Press any key to start. Sound turns on with your first tap, click or key press.

Keys are labeled with the computer key that plays them. Hold Space for sustain. Press lower on a key to play louder.

How to play

  • Click or tap a key to play it. Press lower on the key for a louder note.
  • Use your computer keyboard: the bottom row Z to M starts at C3 and the top row Q to P starts at middle C.
  • Turn on Sustain, or hold the Space bar, to let notes keep ringing.
  • Drag across the keys with the mouse to glide, or swipe sideways to reach other octaves.

What this virtual piano is

This page gives you a playable piano keyboard that runs entirely in your browser. Press a key with your mouse, tap it on a touch screen, or use your computer keyboard, and the note sounds immediately. There is nothing to download, no account to create and no audio files to wait for, because every note is generated on your device as you play.

The keyboard covers five octaves, from C2 to B6. That is 60 keys, 35 white and 25 black, or a little over two thirds of the 88 keys on a full-size acoustic piano. On a narrow screen the keyboard scrolls sideways so that each key stays large enough to tap.

How a piano makes its sound

An acoustic piano is a stringed instrument played through a keyboard. Pressing a key throws a felt-covered hammer against one to three tightly stretched steel strings, then lets it fall back so the strings can vibrate. A damper rests on the strings until the key is pressed and drops back when it is released, which ends the note. Bartolomeo Cristofori built the first instruments of this kind in Italy around 1700, and his design was named for its ability to play soft and loud, because it responded to how hard the player pressed.

This page does not play recordings. It builds each note with the Web Audio feature of modern browsers, from several sine and triangle waves at the note's pitch and its overtones. A fast attack, a slow decay and a filter that closes as the note fades imitate a string losing brightness, and low notes ring longer than high ones, as on a real piano. The result is a recognizable piano-like sound, but a synthesized approximation, not a sampled concert grand.

Playing with a mouse, touch screen or keyboard

  • Mouse. Click a key to play it and drag across keys to glide from note to note. The upper part of a key plays softly and the lower part plays louder.
  • Touch screen. Tap a key, or hold several with different fingers to play chords. Swipe sideways to reach other octaves.
  • Computer keyboard. Two rows of letters work like piano keys. The bottom row, Z X C V B N M, plays the white keys of one octave starting at C, with S D G H J as the black keys between them. The top row, Q W E R T Y U I O P, plays white keys an octave higher, with 2 3 5 6 7 9 0 as its black keys. By default Z is C3 and Q is middle C, and each key shows its letter.
  • Keyboard navigation. Tab to the piano, move with the arrow keys, and press Enter or Space to play.

What the controls do

Volume sets the overall loudness. Sustain copies the right pedal of an acoustic piano, which lifts every damper so notes keep ringing after you let go. Press the button to latch it on, or hold Space while no button has focus.

Octave down and Octave up choose which part of the keyboard your computer keys control, from C2 to C4 at the start of the bottom row. Note names shows or hides the letters on the white keys, and Play C major scale plays eight notes so you can hear the pattern first. The line under the controls shows the name and frequency of the last note you played.

Notes, octaves and frequencies

Western music uses twelve notes that repeat in a cycle: C, C sharp, D, D sharp, E, F, F sharp, G, G sharp, A, A sharp and B. White keys play the seven natural notes and black keys play the sharps between them, and C sharp and D flat are the same pitch. After B the pattern restarts at the next C, one octave higher.

Black keys come in groups of two and three, which helps you find your place: the white key just left of any pair is always C. The number in a note name is its octave, so middle C is C4 and the next C up is C5.

Each octave doubles the frequency. A4, the A above middle C, is tuned to 440 Hz by convention and A5 is 880 Hz, while middle C is about 261.6 Hz. The page uses equal temperament, where every semitone is the same size.

Beginner exercises

  1. Find every C. Play the white key left of each pair of black keys and say its name.
  2. Five-finger position. Rest your right-hand fingers on C D E F G, thumb on C, and play up and down. On the computer keyboard these are Q W E R T.
  3. C major scale. Play C D E F G A B C. A common right-hand fingering is 1 2 3, thumb under to 1, then 2 3 4 5. Press "Play C major scale" first to hear it.
  4. A first melody. Mary Had a Little Lamb begins E D C D E E E, D D D, E G G. Ode to Joy begins E E F G G F E D C C D E E D D.
  5. Three chords. Play C E G together for C major, F A C for F major and G B D for G major, then C major again. With the default layout these are Q E T, R Y I, T U O and Q E T.

What a virtual piano is good for

A browser piano is a quick way to learn the keyboard layout and note names before you commit to an instrument. Singers can play a reference note to match their pitch, and songwriters can sketch a melody or chord idea when nothing else is nearby. Teachers can use it to show children higher and lower sounds, and students can practice ear training by playing a note and trying to name it. It pairs well with the online metronome for keeping time and the online synthesizer when you want a different sound.

Online piano versus a real piano

A real piano gives you things a screen cannot. Its weighted keys respond to the speed of your finger, its strings and soundboard resonate together, and its pedals change the tone in more than an on and off way.

The virtual piano is free, opens in seconds, never needs tuning and works with headphones. Use it to practice note reading and to experiment, and move to a real keyboard or a digital piano with weighted keys if you want to learn technique.

Limitations of this version

  • The sound is synthesized, not sampled, so it will not match a recording of a particular piano.
  • Loudness depends on where you press the key, not how fast, because mice and screens do not measure speed.
  • There is no MIDI keyboard input, and nothing is recorded or saved.
  • At most 28 notes can sound at once, including fading ones. The oldest are cut off.
  • Many computer keyboards register only a limited number of simultaneous keys, so large chords can drop notes.
  • Bluetooth headphones usually add a noticeable delay.

Common problems and how to fix them

  • No sound. Browsers keep audio off until you interact with the page, so click or press a key first. Then check the volume slider, your device volume and the tab's mute icon. On an iPhone, also check the silent switch, because some iOS versions silence web audio when it is on.
  • The wrong notes play. Check the octave setting. The layout follows the physical position of keys, so on a non-US keyboard the letters on your keys may differ from the labels on screen.
  • Computer keys do nothing. Click an empty part of the page so focus is not in another field.
  • The sound is muddy or keeps ringing. Sustain is probably on.
  • The sound lags. Close heavy tabs and switch from Bluetooth to wired headphones.

Frequently asked questions

Is the virtual piano free?

Yes. You can play it without an account, a download or a payment.

Can I play it on my phone?

Yes. Tap the keys with one or more fingers and swipe sideways to reach other octaves. Turning the phone to landscape shows more keys at once.

Can I play with my computer keyboard?

Yes. The bottom row from Z to M starts at C3 and the top row from Q to P starts at middle C, with the number keys and S D G H J as the black keys. Use the octave buttons to move the layout.

Does it work offline?

Once the page has loaded, the sound is generated on your device, so playing continues if your connection drops. You still need a connection to open the page, and there is no installable offline mode.

How accurate is the sound?

The pitches follow standard equal temperament with A4 at 440 Hz. The tone is a synthesized piano-like sound, not a recording of a real instrument.

Does it record or save what I play?

No. The page does not record, save or upload your playing.

Can I connect a MIDI keyboard?

Not on this page. It responds to the mouse, touch and your computer keyboard only.

Why is there no sound?

Click or tap the keyboard first, because browsers block audio until you interact. Then check your volume, the tab mute and, on an iPhone, the silent switch.