Virtual Piano
Play piano directly in your browser without any plugins or downloads. This virtual piano renders 2-3 octaves of playable keys that respond to both mouse clicks and computer keyboard input. The bottom row (Z through M) maps to white keys C through B, with the upper row handling sharps and flats. Sound is synthesized using the Web Audio API with layered oscillators and ADSR envelopes for a realistic piano-like tone. Features include octave shifting from C2 to C7, sustain toggle, note label display, and volume control. Perfect for quick melody sketching, learning basic piano, or testing chord voicings when you are away from a physical keyboard.
Keyboard Shortcuts
Z S X D C V G B H N J M — Lower octave (C4 to B4)
Q 2 W 3 E R 5 T 6 Y 7 U — Upper octave (C5 to B5)
How to Use
- 1
Play with Your Keyboard
Use your computer keyboard to play notes — the bottom row (Z through M) maps to white keys C through B, and the row above handles sharps and flats. Key labels are shown on each piano key.
- 2
Select Octave Range
Use the octave selector to shift the keyboard range from C2 to C7. The piano displays 2-3 octaves at a time, and the octave buttons let you move up or down the keyboard.
- 3
Adjust Sustain and Volume
Toggle sustain mode to hold notes until you release the key for a legato feel, or leave it off for short staccato plucks. Use the volume slider to control overall output level.
- 4
Click or Tap Keys
On mobile or with a mouse, click or tap piano keys directly to play notes. Keys light up when pressed to provide visual feedback of which notes are sounding.
Examples by Niche
Play C major scale (C D E F G A B) using keyboard keys Z X C V G B N to hear the intervals. Toggle note labels on to see each note name displayed on the keys.
Use sustain mode to hold chords — press Z, V, and B together for a C major triad. Shift octaves to find the right register for your vocal melody.
Start in octave 4 with note labels visible. Practice "Mary Had a Little Lamb" using keys V, C, X, Z (E D C D E E E) with visual feedback on each press.
Need to check a pitch for vocal warm-ups? Open the piano, click the target note, and match your voice to the synthesized tone. Faster than finding a physical keyboard.
Frequently Asked Questions
What keyboard keys map to piano notes?
The bottom row (Z, S, X, D, C, V, G, B, H, N, J, M) maps to C, C#, D, D#, E, F, F#, G, G#, A, A#, B in the lower octave. The upper row (Q, 2, W, 3, E, R, 5, T, 6, Y, 7, U) maps to the same notes one octave higher. Key labels are shown on the piano keys and can be toggled on or off.
How does the sound synthesis work?
Each note is generated using Web Audio API OscillatorNodes with a custom waveform that combines the fundamental frequency with harmonics at 2x and 3x the frequency at reduced volume. An ADSR (Attack-Decay-Sustain-Release) envelope shapes the volume over time for a natural piano-like sound with a quick attack, gradual decay, and smooth release.
What does sustain mode do?
When sustain is enabled, notes continue ringing after you release the key, simulating a piano sustain pedal. When sustain is off, notes stop immediately on key release, similar to a staccato playing style. Toggle sustain to switch between legato and staccato playing modes.
Can I use this virtual piano on a phone or tablet?
Yes — the piano keys respond to touch events on mobile devices. Tap keys directly on the screen to play notes. The layout adapts to smaller screens, though the full 3-octave range is best experienced on a desktop or tablet with more screen space.
Related Tools
Ukulele Tuner
Free online ukulele tuner with microphone pitch detection — supports standard, Low-G, baritone, and 5 other tunings.
Guitar Tuner
Free chromatic guitar tuner using your microphone — detects pitch in real time with visual tuning meter.
Drum Machine
Create drum patterns with a 16-step sequencer — kick, snare, hi-hat, clap, and more with Web Audio synthesis.
Related Articles
7 Chord Progressions Every Songwriter Should Know
Learn the most common and effective chord progressions used in pop, rock, jazz, blues, and more. Understand why they work, how to use them, and how to make them your own.
Free Online Music Tools for Songwriters and Music Producers: Your Complete Toolkit
Discover free online music tools every songwriter and producer should bookmark — chord progression generators, lyric writers, virtual instruments, metronomes, tuners, and more. No signup required.