Virtual Piano - Play Piano Online with Your Keyboard

A playable three-octave piano in your browser: click or touch the keys, play from your computer keyboard, or plug in a MIDI keyboard.

Every note is synthesized live with the Web Audio API — no samples to download. The readout shows the exact frequency of the last note you played.

Virtual Piano - Play Piano Online with Your Keyboard
A playable three-octave piano in your browser: click or touch the keys, play from your computer keyboard, or plug in a MIDI keyboard.
Range: C3 – B5
Volume

Last note: play a key to begin

Frequency = 440 × 2^((n − 69) ÷ 12), where n is the MIDI note number — so C4 (n = 60) is 261.63 Hz and A4 (n = 69) is exactly 440.00 Hz.

MIDI: not connected

Computer keyboard: the A S D F G H J K L row plays white keys from the lowest C, and W E T Y U O P plays the black keys between them.

Keyboard to piano-key map
WC#ED#TF#YG#UA#OC#PD#
ACSDDEFFGGHAJBKCLD;E'F

The letters play the lower two of the three octaves shown, starting at the current base octave; shift the octave to reach higher or lower notes.

About this virtual piano

This is a real playable instrument, not a picture of one. The keyboard spans three octaves — C3 to B5 by default, shiftable from C1 up to B7 with the octave buttons — and every key produces a genuinely synthesized tone: two oscillators (a triangle wave for the body of the sound and a quieter sine an octave above for roundness) shaped by a fast attack and a natural decay envelope. Turn on Sustain and notes ring close to three seconds, like holding a piano's damper pedal. There are three ways to play. Click or tap the keys directly — they are drawn with plain CSS, so they work identically on desktop and touch screens. Or use your computer keyboard the way virtually every music app maps it: the home row A S D F G H J K L plays the white keys starting from the lowest C on screen, and the row above — W E T Y U, then O and P — plays the black keys sitting between them. That mapping mirrors the physical geometry of a piano, which is why it has become a standard: A-W-S-E-D is literally C, C-sharp, D, D-sharp, E. Finally, if your browser supports Web MIDI (Chrome and Edge do), press Enable MIDI input and play a connected MIDI keyboard directly. The frequency readout under the keys is a small music-theory lesson in itself. Modern instruments use twelve-tone equal temperament tuned to A4 = 440 Hz: each semitone multiplies frequency by the twelfth root of 2, about 1.05946. Play A4 and you will see exactly 440.00 Hz; play C4 — middle C — and you get 261.63 Hz; go up an octave to C5 and the number doubles to 523.25 Hz. Watching the numbers while you play makes the logarithmic nature of pitch concrete in a way a textbook diagram never quite does. Two octaves is also enough real estate to learn the shapes that matter. Find the white-key major scale starting on C. Build intervals: a perfect fifth is seven semitones (C4 to G4), a major third is four (C4 to E4). Stack them into a C major triad, then slide the third down one key for C minor. Because the note names can be shown on every key, you can connect what you hear, what you see, and what the notation calls it — then hide the names once the geometry sticks. Everything runs locally in the page: nothing is recorded, nothing is uploaded, and after the first load no network connection is needed at all.

Notes, intervals, and chords to try

Verified equal-temperament frequencies at standard A440 tuning.

Play thisYou should seeWhat it teaches
A4 (the A right of middle C)Last note: A4 · 440.00 HzConcert pitch — the reference every orchestra tunes to. All other frequencies are derived from this one.
C4 (middle C)Last note: C4 · 261.63 HzThe center of the keyboard and of grand-staff notation; exactly nine semitones below A4: 440 ÷ 2^(9/12).
C4 then C5261.63 Hz then 523.25 HzAn octave doubles frequency exactly — the most consonant interval there is.
C4 – E4 – G4 together (quickly, with Sustain on)Roughly 261.63, 329.63, 392.00 HzA C major triad: major third (4 semitones) plus minor third (3 semitones) stacked on the root.
A4 then E5 (Octave up if needed)440.00 Hz then 659.26 HzA perfect fifth — the frequency ratio is 1.498, almost exactly the pure 3:2 that equal temperament approximates.

How to play the virtual piano

  1. Click or tap any key — or use your computer keyboard: A S D F G H J K L are the white keys, W E T Y U O P the black keys.
  2. Use Octave down / Octave up to move the two-octave window anywhere from C1 to B7.
  3. Toggle Sustain to let notes ring like a damper pedal, and Show note names to display or hide the labels on the keys.
  4. Watch the readout: it names the last note you played and shows its exact frequency in hertz.
  5. Have a MIDI keyboard? Press Enable MIDI input (Chrome or Edge) and play it directly.

Virtual piano FAQ

Why does A4 show exactly 440.00 Hz?
A4 = 440 Hz is the international standard concert pitch (ISO 16). Every other note is derived from it in equal temperament: each semitone up multiplies the frequency by the twelfth root of 2, so twelve semitones — one octave — exactly doubles it to 880 Hz.
What is the computer-keyboard layout and why that one?
A S D F G H J K L play the white keys from the lowest visible C, and W E T Y U O P play the black keys above them — the same convention used by GarageBand, Ableton Live, FL Studio and most DAWs. It works because the QWERTY rows physically mirror a piano: the upper row sits between the lower keys just like black keys sit between white ones.
How is the sound made?
Each note runs two Web Audio oscillators — a triangle wave at the note's frequency for warmth and a quieter sine one octave higher for a rounded top — through a gain envelope with an 8 ms attack. With Sustain off the note decays in about half a second; with Sustain on it rings for nearly three, like holding the pedal.
Does MIDI input work in every browser?
Web MIDI is supported in Chromium browsers (Chrome, Edge, Opera, Brave); Safari and Firefox do not ship it by default. The button is safely guarded: on unsupported browsers you simply get a 'not supported' notice, and clicking keys or typing still works everywhere.
Is this good enough to learn piano on?
It is excellent for learning the geometry — key names, scales, intervals, and chord shapes — and for ear training against exact frequencies. It cannot teach touch dynamics, since computer keys are not velocity-sensitive; when you move to a real or MIDI keyboard, the layouts transfer directly.
Why can I not hear anything?
Browsers only allow sound after a user gesture, so the audio engine starts on your first click or key press. If it stays silent, check the Volume slider here, your system output device, and whether the tab is muted. The note readout updates regardless, which confirms the keys are registering.