MT Music Tools

Virtual Piano

Play a free online piano with your mouse, touchscreen or computer keyboard. Polyphonic, with sustain, octave shift and volume — no download needed.

🔒 Runs entirely in your browser — nothing is uploaded
C3–E5

Click or tap a key, or play with your computer keyboard (Z–M lower row, Q–U upper row, I–P top). Use − / = to shift octaves.

Advertisement

A piano in your browser

This virtual piano gives you a playable keyboard of two octaves and a third — 29 keys from C to E — right in your browser. You can play it with a mouse, with one or more fingers on a touchscreen, or with your computer keyboard, where every key on screen is labelled with its shortcut. It is handy for checking a melody you have in your head, finding the starting note of a song, working out chords, practising simple pieces when you are away from a real instrument, or just having fun.

The octave buttons move the whole keyboard up or down by twelve semitones, so the range covers from C1 to E7 in total. The current range is shown between the buttons, and the C keys are labelled with their octave number (middle C is C4). A sustain toggle works like the right pedal of an acoustic piano, letting notes ring and overlap, and the volume slider sets the overall level.

How the sound is made

Nothing is downloaded or streamed: each note is synthesised on the fly with the Web Audio API. A triangle-wave oscillator provides the body of the tone and a quieter sine wave an octave above adds brightness. A gain envelope gives each note a quick attack followed by a gradual decay, similar to a struck string, and a compressor on the output keeps big chords from distorting. Because the sound engine is created only when you first press a key, the page stays light and complies with browser autoplay rules.

Playing with the computer keyboard

The layout mirrors a piano: the bottom row of letters (Z to M) is the lower octave's white keys and the row above it (S, D, G, H, J) supplies the black keys. The top letter row from Q to U is the next octave, with the number keys 2, 3, 5, 6 and 7 as sharps and flats, and I, 9, O, 0 and P reach the top of the keyboard. Keys are matched by their physical position, so the layout works the same on QWERTY, AZERTY and QWERTZ keyboards. Hold several keys together to play chords.

How to use

  1. Play a keyClick or tap any key, or press the letter shown on it on your computer keyboard.
  2. Change the octaveUse the − and + buttons (or the − and = keys) to move the keyboard up or down.
  3. Shape the soundTurn sustain on to let notes ring after you release them and adjust the volume slider.

Frequently asked questions

Which computer keys play which notes?
The bottom letter row (Z, X, C, V, B, N, M) plays the white keys of the lower octave with S, D, G, H and J as the black keys. The top letter row (Q to U) plays the next octave with the number keys 2, 3, 5, 6 and 7 as black keys, and I, 9, O, 0 and P continue upwards. Each key on screen shows its shortcut.
Can I play chords?
Yes. The piano is polyphonic, so you can hold several keys at once with the keyboard, or use multi-touch on a phone or tablet.
What does sustain do?
Like a piano's sustain pedal, it keeps notes ringing after you let go of the key so they fade out naturally. Turn it off to stop any notes you are no longer holding.
Why is there no sound?
Browsers only allow audio after you interact with the page, so the sound engine starts on your first key press. Check that your device is not muted and that the volume slider is up.
Advertisement