Skip to the instrument
Tic Tac Toe

Virtual Piano

Play this virtual piano with your computer keyboard, mouse, or fingertips. Switch between grand piano, electric piano, and organ, follow an easy song, or record yourself.

Play the virtual piano

Octave 3

Tap or click the keys, or slide across them. On a computer keyboard, Z to M play the lower octave and Q to U the one above, with the black keys on the rows above them. Hold Space for sustain, and press ← or → to change octave.

Sound and keys
Your settings are saved in this browser.
Sound
Labels on the keys
70%
Songs and recording
Learn a tune key by key, or record yourself and play it back.
    Pick a song and press Start
    RecorderNo recording yet

    How it works

    How to play the virtual piano

    Start from middle C, the Q key at the default octave, pick a sound, and play by touch, mouse, or the letter rows, or follow a glowing key through one of six easy songs.

    1. Step 01

      Play the keys

      Tap or click a key, or slide across several. On a computer, Z to M play one octave and Q to U the next, with the black keys on the rows above. ← and → change octave.
    2. Step 02

      Choose a sound

      Pick Piano, Electric, or Organ and set the volume. Hold Space, or press Sustain, to let notes ring after you let go.
    3. Step 03

      Play a song or record

      Choose a song and press Start: the next key glows until you play it. Or press Record, play, press Stop, and then Play to hear it back.

    Features

    A virtual piano with real piano habits

    • All 88 keys

      Slide through six octave positions, from the lowest A to the top C8. On screen you see as many keys as fit, about three octaves on a wide display.

    • Play with your computer keyboard

      Four rows of keys cover 32 notes, from C to the G two octaves up. Set the labels to Keyboard to see which key plays each note.

    • Three sounds

      A grand piano whose low notes ring for seconds, a bell-like electric piano, and an organ that holds as long as you do.

    • Six easy songs, key by key

      The next key glows and waits for you, from Twinkle, Twinkle to the opening of Für Elise. Listen plays the tune first.

    • Record and play back

      Record one take of up to 10 minutes, sustain pedal included, and play it back. It's saved in this browser.

    • Chords named as you play

      The display shows each note with its pitch in hertz, and names the chord you hold, such as C, Am7, or G/B.

    Tips

    Virtual piano tips for the computer keyboard

    A computer keyboard is flatter and smaller than a piano's, but the patterns are the same. These habits make playing it feel more natural.

    • Find C first

      Every C sits just left of a pair of black keys. With Notes labels on, each C shows its octave number, so middle C reads C4.

    • Build chords from one shape

      A major chord is a root, the key four half steps up, and the key three more above that. C, E, and G is Z, C, and B. Swap C for D and it turns to C minor.

    • Change the pedal with the chord

      Hold Space while a chord rings, lift it as you play the next chord, and press it again straight after. The sound stays smooth without blurring.

    • Mind the keyboard limit

      Many computer keyboards can't register some combinations of three or more keys at once. If a note drops out, try another octave or use touch.

    • Listen, then play

      Press Listen to hear a song at its normal speed, then Start to play it key by key. When it feels easy, set the labels to None and try again.

    • Hear a take on another sound

      Playback uses the sound that's selected now. Record on the grand piano, switch to Organ, and press Play to hear the same notes in a new color.

    About the instrument

    Virtual piano online: play, follow songs, and record in your browser

    How the keys and octaves work, the three sounds, the sustain pedal, songs, the recorder, and how the sound is made.

    This virtual piano runs in your browser on a computer, tablet, or phone. Play it with your computer keyboard, a mouse, or your fingers, pick a grand piano, electric piano, or organ, follow six easy songs key by key, and record what you play. There's nothing to install.

    How the virtual piano keyboard works

    The keys follow a real piano: white keys for the notes A to G, and black keys in groups of two and three for the sharps and flats in between. The piano shows as many keys as fit your screen, about three octaves on a wide display and fewer on a phone, and the octave buttons slide the view. They reach all 88 keys, and the computer keys play C1 to C8.

    The display above the keys names the sound and the notes the computer keys cover, such as Keys C3–G5. Play one note and it shows its name and pitch, so A4 reads 440 Hz. Hold two or more and it names the chord: C, Am7, or G/B when the B is in the bass.

    Play the virtual piano with your computer keyboard

    On the bottom letter row, Z X C V B N M are the white keys from C to B, and S D G H J on the row above are the black keys between them. The top letter row starts the next octave: Q W E R T Y U are white keys again, with their black keys on the number row, 2 3 5 6 7. Both rows carry on past the octave, to / below and ] above, so together they cover 32 notes, from C up to the G two octaves higher.

    • ← and → move the computer keys an octave, from octave 1 to 6. At the default, octave 3, Z plays C3 and Q plays middle C.
    • Space is the sustain pedal while you hold it.
    • Set Labels on the keys to Keyboard to see which key plays each note. The piano reads key positions, not letters, so on layouts such as AZERTY the same spots play the same notes, and browsers that share the layout label them with your letters.

    Typing in a text box never plays a note.

    Grand piano, electric piano, and organ sounds

    Piano is a grand piano. Low notes ring for several seconds and fade slowly, high notes are short and bright, and each note starts with a soft hammer thump. Low notes sit to the left and high notes to the right, the way you hear them from the bench.

    Electric is an electric piano with a bell-like tone: a little bark as the key goes down that mellows as it fades. Organ holds every note at full level for as long as you keep the key down, with a gentle vibrato and a short percussive ping at the start.

    The sustain pedal and the top keys

    On an acoustic piano, felt dampers stop a string as soon as you let go of its key, unless the sustain pedal holds them off. This piano works the same way. Hold Space, or press Sustain to latch it on, and notes you release keep ringing until the pedal lifts. The keys from F6 to the top have no dampers, as on a real piano, so they ring on after you let go even without the pedal.

    Up to 40 notes can sound at once; past that, the oldest fades out.

    Six easy songs, one key at a time

    Pick a tune under Learn a song and press Start. The next key glows amber, and the piano moves to show it. Play it and the next one lights up. There's no clock, so you can take each note at your own pace, and a wrong key sounds but doesn't move you on. Press Listen first to hear the tune at its normal speed.

    • Twinkle, Twinkle, Little Star: 42 notes
    • Mary Had a Little Lamb: 26 notes
    • Ode to Joy, from Beethoven's Ninth Symphony: 30 notes
    • Happy Birthday: 25 notes
    • Jingle Bells: 51 notes
    • The opening of Für Elise by Beethoven: 35 notes

    Each song is the melody only, for one hand, and stays between G3 and E5, close to middle C.

    Record yourself and play it back

    Press Record, play, and press Stop. The recorder notes every key you press and release, to the millisecond, along with the sustain pedal, so Play follows your timing. It stops by itself at 10 minutes or 4,000 events, whichever comes first. Each press, release, and pedal change is one event, so that's about 2,000 notes.

    There's one saved take. Recording again replaces it, and the eraser button deletes it. Playback uses the sound that's selected now, so you can record on the grand piano and hear the same take on the organ. The Listen demos are never recorded.

    Landmarks: C, half steps, and chord shapes

    A few landmarks make the keys easier to find:

    • Every C sits just left of a group of two black keys, and middle C is C4.
    • Each key, white or black, is one half step from the next.
    • A minor chord lowers the middle note of a major chord by one half step: C major is Z C B and C minor is Z D B.
    • On a touch screen, keep each finger still. Sliding moves the note to the next key.

    The four pads in Pattern Echo play C4, E4, G4, and C5, so you can pick out its patterns on these keys too.

    How the virtual piano makes its sound

    No recorded samples are downloaded: every sound is made in your browser with the Web Audio API. A grand piano note is built from up to 24 overtones, each a fading sine wave. They're tuned slightly sharp, the way stiff piano strings ring, and the lowest six are split into pairs a hair apart, like the paired strings of a real piano, so the tone shimmers. The overtone mix follows where a hammer strikes the string.

    To keep start-up quick, the piano renders one note in every three keys and plays its neighbors a semitone higher or lower, the way sampled pianos stretch their recordings. The electric piano uses two-operator FM synthesis, and the organ blends drawbar-style harmonics from 16′ to 1′. Everything passes through a small room reverb and a gentle compressor that keeps big chords from distorting.

    Where the piano and its sounds came from

    Bartolomeo Cristofori built the first pianos in Florence around 1700. Unlike the harpsichord, which plucks its strings, his instrument struck them with hammers, so it could play soft or loud depending on touch. He called it a harpsichord with soft and loud, which gave us the names pianoforte and piano. A modern concert grand has 88 keys, from A0 to C8.

    The electric piano sound has its own story. John Chowning developed FM synthesis at Stanford, Yamaha licensed it, and the DX7 synthesizer of 1983 brought FM electric pianos to a wide audience. This site isn't affiliated with Yamaha.

    Touch, mouse, keys, and screen readers

    The piano runs in any modern browser on a Windows PC, Mac, Chromebook, iPhone, iPad, or Android device:

    • Touch: every finger plays its own key, and sliding along the keys plays a run. Turn a phone sideways to see more keys.
    • Mouse: click a key, or hold the button and drag across several.
    • Keyboard: the letter rows play notes, the arrows change octave, and Space is the pedal.
    • Screen readers: each key has a spoken name, such as C sharp 4, and song prompts are announced.

    The page needs a connection to load. After that, every note is synthesized on the device in front of you, from the hammer thump to the room reverb.

    Saved on this device: your sound, song, and take

    Come back later and the piano still has your sound, key labels, octave, volume, chosen song, and your one recording, because they sit in this browser's local storage under virtual-piano:v1, an entry the privacy policy describes. The notes you play and the take you record aren't sent to a server. Clearing this site's data in your browser settings erases them.

    Want a beat to play along with? Open the Virtual Drums, or strum chords on the Virtual Guitar.

    FAQ

    Virtual piano questions

    Quick answers about the virtual piano: computer keys, octaves, chords, the sustain pedal, songs, recording, and sound.

    How do I play the piano with my computer keyboard?

    Z to M play the white keys of one octave, with S, D, G, H, and J for the black keys. Q to U play the next octave up, with the black keys on 2, 3, 5, 6, and 7. Set the labels to Keyboard to see the key on each note.

    How do I change octave?

    Press the left or right arrow key, or the arrow buttons beside the octave number. The computer keys move one octave at a time, from octave 1 to octave 6, and the keys on screen follow.

    Can I play chords?

    Yes. Hold several keys with several fingers on a touch screen, or several letters on a computer keyboard, and the display names the chord. Some keyboards can't register every combination of three or more keys, so a note may drop out.

    Is there a sustain pedal?

    Yes. Hold Space to use it like a pedal, or press Sustain to keep it on. Notes you let go of keep ringing until the pedal lifts. The keys from F6 up have no dampers, so they ring on anyway.

    Which songs can I play?

    Twinkle, Twinkle, Little Star, Mary Had a Little Lamb, Ode to Joy, Happy Birthday, Jingle Bells, and the opening of Für Elise. Press Start and the next key glows until you play it, or press Listen to hear the tune first.

    Can I record what I play?

    Yes. Press Record, play, then press Stop, and Play to hear it back. One take of up to 10 minutes or 4,000 events is kept in this browser's local storage, and recording again replaces it.

    Can I connect a MIDI keyboard?

    No. This piano plays from touch, a mouse, and the computer keyboard only. It doesn't read MIDI keyboards or other music devices.

    Why is the piano silent?

    Browsers keep a page quiet until you tap, click, or press a key on it, so play one key to wake the sound. If it's still silent, look at the piano's volume slider, your device's volume, and whether this tab is muted.

    Why do I see fewer keys on my phone?

    The piano keeps each key wide enough to tap, so it shows only as many as fit the screen. Turning a phone sideways gives you more, and the octave buttons slide the view along all 88 keys.