Virtual Piano

A 3D grand piano you can turn, tilt and play 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 nearer the front of a key to play louder. In the 3D view you can also press the three pedals under the piano with the mouse or your finger.

How to play

  • Click or tap a key to play it. Press nearer the front of the key for a louder note.
  • In the 3D view, drag empty space to turn the piano, right-drag or use two fingers to move it, and use Ctrl and scroll or the + and - buttons to zoom.
  • 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 from note to note. Press the pedals under the piano for sustain, a softer sound, or to hold only the notes already down.

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 has the full 88 keys of a concert piano, from A0 to C8: 52 white keys and 36 black keys. It opens as a 3D grand piano that you can look at from any side. Every key moves when you press it, a hammer strikes the strings inside, and the pedals underneath work. Prefer a plain keyboard? Switch off 3D view and the flat keyboard, which scrolls sideways on a narrow screen, takes its place.

Using the 3D grand piano

The piano is drawn in real time with WebGL, so you can inspect it the way you would walk around a real one. The buttons above the piano jump to useful positions, and you can move the camera freely at any time.

  • Turn it. Drag empty space, such as the floor or the case, with the mouse or one finger. Dragging on a key plays it instead, so start your drag beside the keys.
  • Move and zoom. Right-drag, or use two fingers, to slide the view along the keyboard. Hold Ctrl (Cmd on a Mac) and scroll, pinch on a trackpad, or use the + and - buttons to zoom. Plain scrolling still scrolls the page.
  • Player view looks down at the keys from the bench. Whole piano shows the full instrument from the side. Hammers & strings moves in close to the action, and Pedals drops down to the pedals so you can see them move.
  • Full screen (or the corner button on the piano) shows only the piano, edge to edge. Press Esc or use the corner button to leave. On a phone it also turns the screen to landscape where the browser allows it.
  • Lid open raises or lowers the lid. Music desk puts a stand with sheet music on top of the piano, which hides the strings from the player's seat, so it starts off.
  • Pedals. Press and hold a pedal under the piano. The right pedal is sustain, the left pedal is the soft pedal, which plays quieter, and the middle pedal is sostenuto, which holds only the notes that were already down when you pressed it.

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.
  • The 3D view needs WebGL and is heaviest on old phones. Switch it off for the flat keyboard if it runs slowly. The flat keyboard is also the one that works with Tab and the arrow keys.
  • 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 3D piano is slow or does not appear. Turn off 3D view to use the flat keyboard, close other heavy tabs, and check that hardware acceleration is on in your browser settings.
  • 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, drag empty space to turn the piano, and use two fingers to zoom or slide along the keyboard. Turning the phone to landscape shows more keys at once.

Is it really 3D?

Yes. The piano is a 3D model drawn in your browser. You can rotate it, tilt it, zoom in, open or close the lid, and watch the keys, hammers and pedals move as you play.

Why is the 3D view missing on my device?

The browser needs WebGL, and some very old or restricted devices do not have it. In that case the page shows the flat keyboard, which plays exactly the same.

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.