~/online-virtual-piano 🥁 drums 🎮 8bit 🖐️ hands ☕ Support me apps ← about me
 _______________________________________
|  | | | |  | | | | |  | | | |  | | | | | |
|  | | | |  | | | | |  | | | |  | | | | | |
|  |_| |_|  |_| |_|_|  |_| |_|  |_| |_|_|_|
|   |   |    |   |   |   |   |    |   |   | |
|___|___|____|___|___|___|___|____|___|___|_|

Online Virtual Piano_

Play, record and learn piano with your computer keyboard — 7 instruments, 2.4 octaves, real dynamics, no download. 🎹
Type Z X C V B N M and Q W E R T Y U  ·  ← / → octave  ·  Shift = sustain
⛶ fullscreen

A piano you play by typing

Online Virtual Piano turns your computer keyboard into a playable instrument. Two rows of keys are mapped to 2.4 octaves — enough to play real melodies without constantly shifting position. Every note is synthesised live in your browser: nothing downloads, and it keeps working offline.

There are seven instruments — Concert Grand, Soft Felt, Bright Upright, Honky-Tonk, Electric Piano, Music Box and Harpsichord. None of them is a sample: each is the same engine driven by different physics, so switching is instant and adds nothing to load. They are also loudness-matched, so changing instrument changes the character without a jump in level.

The tone is modelled rather than sampled. Strike harder and the note gets brighter, not just louder, because more upper partials are excited — the single most important thing that makes a piano sound like a piano. Partials are stretched slightly sharp to imitate string inharmonicity, upper partials fade before the fundamental, each note carries a short hammer thump, and bass strings ring for many seconds while the top notes die away quickly.

7 instruments2.4 octavesvelocity dynamicsconvolution reverblearn modeMIDI exportUSB MIDI inno download

How to play

Z X C V B N MWhite notes, lower octave S D  G H JBlack notes, lower octave Q W E R T Y U I O PWhite notes, upper octave 2 3  5 6 7  9 0Black notes, upper octave ← / →Octave down / up Shift / SpaceHold for sustain pedal Alt / CtrlHold for a soft / hard strike EscExit fullscreen
FAQ & about the virtual piano

FAQ — Online Virtual Piano

Playing it
How do I play the piano with my keyboard?

Press the letter keys. Two rows are mapped: the bottom row (Z X C V B N M) plays the lower octave with S D G H J as its black keys, and the QWERTY row (Q W E R T Y U I O P) plays the octave above with 2 3 5 6 7 9 0 as its black keys. You can also click with the mouse or tap on a touchscreen.

How many octaves can I play at once?

About 2.4 octaves — 29 semitones — across the two key rows. That is wide enough for most melodies and simple two-hand arrangements without touching the octave shift. The older version of this page mapped only 1.5 octaves, which meant constantly jumping octaves mid-phrase.

I have an AZERTY or QWERTZ keyboard — will the keys still line up?

Yes, and there is nothing to configure. The piano listens to the physical position of each key rather than the character it produces, so the note under your finger is identical on every layout. The layout selector only changes the letters drawn on the on-screen keys so they match your keycaps — including the accented characters AZERTY puts on the number row.

How do I change octave?

Use the Octave − / + buttons or the ← / → arrow keys. The range your keyboard currently controls is marked with a cyan strip along the top of those keys, so you can always see where your hands sit on the instrument.

Is there a sustain pedal?

Yes. Hold Shift or the Space bar while playing, or switch on Sustain in the panel to latch it. Notes keep ringing and a little extra resonance is added, mirroring the way lifting the dampers on a real piano lets other strings vibrate in sympathy.

Can I play louder or softer from the computer keyboard?

A computer key has no pressure sensor, so notes default to a medium-firm velocity. Hold Alt as you strike for a soft, dark note and Ctrl for a hard, bright one — enough to shape a phrase. For continuous control, connect a MIDI keyboard.

Some keys do not sound when I press several at once.

That is your keyboard, not the page. Most membrane keyboards can only report a few simultaneous keypresses per region — a hardware limitation called ghosting or limited key rollover. Mechanical keyboards with N-key rollover do not have this problem, and neither does a connected MIDI keyboard.

What do the falling colours on screen mean?

When you play freely they are just a visualisation: each note throws up a coloured column above its key, tinted by pitch and sized by how hard you played. In learn mode the same lanes are reused to show notes descending towards the key you need to press next.

Does it work on a phone or tablet?

Yes. Tap the on-screen keys, and slide your finger across them to glissando. Fullscreen in landscape gives the most usable key width. There is no computer keyboard on a phone so the typing shortcuts do not apply, but touch, learn mode and recording all work normally.

The sound
What instruments can I choose from?

Seven, all built by the same engine rather than loaded as samples: Concert Grand (big, bright, long sustain), Soft Felt (muted and intimate — the lo-fi ballad sound), Bright Upright (tight and punchy), Honky-Tonk (detuned twin strings, saloon character), Electric Piano (tine with bell attack and tremolo), Music Box (glassy struck bars) and Harpsichord (plucked and bright). Switching is instant and costs no download, because only the parameters change.

Why does the Honky-Tonk sound out of tune?

Because it is, deliberately. A honky-tonk piano has its twin strings pulled about 15 cents apart, so each note plays two slightly different pitches at once. They drift in and out of phase, producing the shimmering beat that gives saloon and ragtime piano its character. This voice runs two detuned oscillator banks per partial to reproduce it.

Why is the Harpsichord the same volume however hard I play?

That is historically correct, not a bug. A harpsichord plucks its strings with a quill, and a pluck releases the same energy no matter how firmly you press — which is precisely why the piano was invented, and why its original name was gravicembalo col piano e forte, "harpsichord with soft and loud". This voice ignores velocity to match. Every other instrument here responds to touch.

Why does the Music Box sound bell-like rather than string-like?

Because struck metal bars do not vibrate in whole-number harmonics the way strings do. A free bar's modes sit at roughly 1 : 2.76 : 5.40 : 8.93 times the fundamental, which is why bells and glockenspiels sound glassy and slightly clangorous instead of warm. That voice uses those real ratios rather than a harmonic series.

Are the instruments matched in volume?

Yes, and not by ear. Each voice was rendered offline across five registers and its loudness measured, then trimmed to match the Concert Grand — that took a 17.9 dB spread down to about 1.2 dB, so switching instrument changes the tone without a jump in level. Headroom is set so even a hard four-note chord stays below full scale at maximum volume.

Why does the Room slider move when I change instrument?

Each instrument suggests a sensible amount of space — a felt piano wants more, a bright upright wants less, a music box wants a lot. The slider moves visibly so it is obvious what happened, and you can override it immediately afterwards; your choice stays until you switch instrument again.

Does it use recorded piano samples?

No — every note is synthesised live with the Web Audio API, so there is nothing to download and it works offline. The synthesis deliberately models several things real pianos do: harder keystrokes produce brighter tone rather than merely louder tone, partials are stretched slightly sharp to mimic string inharmonicity, upper partials decay faster than the fundamental, each note gets a brief hammer-strike noise, and bass notes ring far longer than treble notes.

Why do the highest notes keep ringing after I let go?

That is intentional, and it is what a real piano does. On an acoustic piano the top octave has no dampers — very short strings lose their energy quickly by themselves, so fitting dampers there is pointless. Those notes therefore continue sounding after you release the key. This piano copies that behaviour above roughly C6.

What is the difference between velocity and volume?

Volume is one control over how loud everything is. Velocity is how hard a single note is struck, and on a piano it changes tone as well as level: a hard strike excites more upper partials and sounds brighter and more percussive, a soft one is rounder and darker. Because this instrument models that relationship, a MIDI keyboard gives genuinely different timbre across the dynamic range rather than just a louder note.

Can I change how much reverb there is?

Yes, the Room slider. At zero you hear the raw instrument, which is useful for judging exactly what you are playing. Higher settings place the piano in a progressively larger, more reflective space. The reverb is a real convolution, generated in the browser from a synthetic impulse response, so it adds no download.

Why can I only hold a limited number of notes at once?

There is a 16-note polyphony limit. Each sounding note runs several oscillators, so without a cap a long pedalled passage would slowly saturate the audio thread and begin to crackle. When the limit is hit the oldest and quietest note is faded out first, which is normally inaudible.

Why is there no sound until I click or press a key?

Browsers block audio until you interact with the page, to stop sites making noise at you unprompted. The first click or keypress starts the engine. If you still hear nothing, check the tab is not muted and the volume slider is up.

There is a delay between pressing a key and hearing it.

Notes are generated the instant the key event arrives, so latency comes from your audio hardware and browser rather than this page. Closing other audio apps, using wired rather than Bluetooth headphones, and using Chrome usually give the lowest latency. Bluetooth alone adds 100–200 ms that nothing in a browser can remove.

Learning & recording
How does learn mode work?

Pick a song and the notes fall down the screen towards the keyboard, lighting up each key as it lands. Use the tempo slider to slow a tricky passage down. Turn on Wait for me and the song pauses on every note until you play it correctly, so you can work through a piece at your own pace instead of chasing the playback.

Which songs are included?

Ten melodies, all firmly in the public domain: Für Elise, Ode to Joy, Moonlight Sonata, Twinkle Twinkle Little Star, Happy Birthday, Jingle Bells, Silent Night, Amazing Grace, Greensleeves and Scarborough Fair. They are arranged as single-line melodies for learning, not as full concert arrangements.

Can I record what I play?

Yes. Press Record, play, then Stop. You can replay the take, download it as a real .mid file, or copy a share link that reproduces the performance for anyone who opens it.

What exactly is in the exported MIDI file?

A standard format 0 MIDI file at 480 ticks per quarter note and 120 BPM, containing note-on and note-off events with the velocity you played. It opens in GarageBand, Logic, Ableton, FL Studio, Reaper or MuseScore. A MIDI file carries notes, not audio, so it will play back through whichever instrument your software assigns — it will not sound like this page unless you point it at a piano.

How long can a share link be?

The whole performance is packed into the link itself, so nothing is stored on a server — but browsers and chat apps limit URL length. Takes up to roughly 250 notes encode comfortably; beyond that you will be told to use the MIDI export instead, which has no limit.

Can I use a real MIDI keyboard?

Yes. Plug in a USB MIDI keyboard, click Connect MIDI and allow access when asked. Notes arrive with true velocity, so dynamics and timbre respond as they would on hardware. Web MIDI is supported in Chrome, Edge and Opera; Safari and Firefox do not implement it, so use the computer keyboard there.

Can I use what I record commercially?

Yes — what you play is yours, with no watermark and no attribution required. One caveat worth stating plainly: that covers your performance. If you record a piece that is still under copyright, the underlying composition is a separate question from the recording you just made.

Privacy, offline & cost
Are my recordings uploaded anywhere?

No. Everything runs in your browser. Recordings stay in memory until you export them, settings are kept in your own browser's local storage, and no audio or performance data is ever sent to a server. There is no account and no tracking of what you play.

Are my settings remembered?

Yes — volume, reverb, layout, octave, the label toggles and sustain are saved to your browser's local storage and restored next visit. Nothing leaves your device; clearing browser data resets everything to defaults.

Does it work offline?

Once the page has loaded, yes. All sound is generated locally and no audio files are fetched, so you can keep playing with the connection off. Only the web font and the share-link feature touch the network.

How do I run it fullscreen?

Click the ⛶ fullscreen hint or the Enter Fullscreen button. Press Escape or the ✕ Exit button to leave. The keyboard stays fully playable in fullscreen, including on iPhone and iPad.

Is it free?

Completely free — no account, no ads, no watermark. It is one of the free browser-based tools at jasperbernaers.com. If it saved you some time, you can buy me a coffee, but it is never required.

Playing piano in a browser, and what that actually gets you

A virtual piano is not a replacement for a weighted instrument, and it is worth being honest about that up front: no browser page can reproduce the feel of a hammer action under your fingers. What it can do is remove every barrier between you and the notes. There is nothing to buy, install, tune or find space for, and a melody you want to try at one in the morning is about four seconds away.

Why this one is synthesised rather than sampled

Most online pianos either use a handful of recorded samples or a very plain oscillator. Samples sound authentic but cost megabytes and break the moment the connection does. A plain oscillator loads instantly but sounds like a toy, mostly because it misses the single most characteristic thing about a piano: striking a key harder changes the tone, not just the level. Hit a real string hard and the hammer excites far more upper partials, giving that bright percussive edge; brush it gently and you get a round, dark, almost flute-like note.

This page takes the third route — model the instrument well enough that it behaves correctly, while still loading instantly and working offline. Alongside velocity-dependent brightness it reproduces string inharmonicity (real piano partials sit progressively sharp of exact harmonic multiples, which is precisely why pianos are tuned with stretched octaves), partial-dependent decay so the tone mellows as it rings, a short hammer noise at the attack, and a decay time that varies enormously across the instrument.

RegisterApproximate ring timeWhy
Bass (A0–C2)15–25 secondsLong, heavy strings hold energy for a very long time
Middle (C3–C5)5–10 secondsThe singing register most music sits in
Treble (C6–C8)1–3 secondsShort strings shed energy fast — which is why they need no dampers

Seven instruments from one engine

Because the instrument is described by parameters rather than stored as audio, adding a voice costs nothing to download. Each preset changes the physics rather than applying an effect:

InstrumentWhat is actually different
Concert GrandNine partials, long per-register decay, moderate string stiffness
Soft FeltSteep high-frequency rolloff, slow attack, exaggerated felt thump — the modern lo-fi ballad sound
Bright UprightMore partials, shorter strings so higher inharmonicity, fast clicky attack
Honky-TonkTwin oscillator banks 15 cents apart, producing genuine beating
Electric PianoTine bell partial at 6.4× that barks on hard notes, plus a 5.2 Hz tremolo
Music BoxInharmonic bar modes at 1 : 2.76 : 5.40 : 8.93 instead of a harmonic series
HarpsichordSawtooth pluck, bright quill transient, and no touch sensitivity at all

That last one is worth dwelling on. A harpsichord plucks rather than strikes, and a pluck imparts the same energy however hard you press the key — you cannot play it louder. That single limitation is why the piano exists: Cristofori's instrument was called gravicembalo col piano e forte, "harpsichord with soft and loud". Selecting the harpsichord here and hammering the keys demonstrates the problem he solved rather better than a paragraph does.

The detail almost every virtual piano gets wrong

On an acoustic piano the top octave or so has no dampers at all. Those strings decay so quickly on their own that fitting dampers would be pointless engineering. The audible consequence is that high notes keep ringing after you release the key, while middle and bass notes stop almost immediately. Nearly every browser piano silences every note identically on key-up. This one does not — release a note above C6 and it rings on, exactly as it would on a real instrument.

Learning a melody without reading notation

Falling-note guidance is how most people now learn a first tune, and it works because it removes two problems at once: you do not need to read staff notation, and you do not need to keep time with a recording that will not wait. Wait for me mode holds each note until you play it, so a difficult bar becomes a puzzle you solve rather than a race you lose. Slow the tempo down, get the fingering under your hands, then raise it. That is genuinely how practice works.

Everything included here is public domain, which matters more than it sounds — a lot of sites quietly serve copyrighted arrangements. Für Elise and Ode to Joy are excellent first pieces because their opening phrases sit inside a single hand position. Twinkle Twinkle and Happy Birthday are better still if you have never played at all.

Recording, and what a MIDI file really is

The recorder captures pitch, timing and velocity, then writes a genuine format 0 MIDI file. It is worth understanding what that gives you: a MIDI file contains no audio. It is a list of instructions — this note, this hard, at this moment — which is why the files are tiny and why they can be edited note by note afterwards in any DAW. Open your export in MuseScore and it becomes sheet music; open it in Logic and you can quantise it, change the instrument, or rewrite a wrong note without replaying anything.

If you have a USB MIDI keyboard, plugging it in bypasses the computer-keyboard limitations entirely: full polyphony with no ghosting, and real continuous velocity feeding the timbre model. Web MIDI is Chromium-only, so Chrome, Edge and Opera work while Safari and Firefox do not.

Privacy

Nothing you play leaves your device. Notes are generated locally, recordings live in memory until you choose to export them, and preferences are stored in your own browser. There is no account, no upload, and no analysis of your playing. Share links carry the performance inside the URL itself rather than on a server, which is also why very long takes have to go out as MIDI instead.