Keyboard Test
Press the keys one by one: each lights up as it works, and the log shows what the browser receives. Hold several at once to check rollover.
Your keyboard
Press any key
Each key lights up as it works. Nothing you type leaves this page.
How this works: Method, 10 sources, Checked against 1 worked example,
How this works
Method
Every test uses your browser’s own interfaces, in this tab only. The mic test measures the microphone’s samples with the Web Audio API (their RMS level in dB relative to full scale), the webcam test reads the size and counts the frames of the video the camera actually delivers, the keyboard, click and spacebar tests count the key and pointer events the page receives, and the gamepad tester reads the Gamepad API once per screen refresh. Nothing is recorded to storage or sent anywhere: a recording or snapshot stays in the tab’s memory until you delete it or leave.
Sources
- Device Class Definition for Human Interface Devices (HID) (USB Implementers Forum, 1.11, 2001)
- UI Events KeyboardEvent code Values (W3C)
- Media Capture and Streams (W3C)
- MediaDevices: getUserMedia() (MDN)
- Web Audio API (W3C)
- MediaStream Recording (W3C)
- UI Events (W3C)
- Pointer Events (W3C)
- Gamepad (W3C)
- Gamepad API (MDN)
How it’s tested
One worked example for this page is checked by automated tests before every release: given the inputs, the tool must show the expected answer.
Changes
- First version: mic, webcam, keyboard, click speed, spacebar and gamepad tests, all on the device.
Example: Shift + A
Hold the left Shift and press A. The log shows two key presses: key “Shift”, code ShiftLeft, location Left; then key “A”, code KeyA, location Standard. Now press the right Shift instead: the key is still “Shift”, but the code is ShiftRight and the location Right. The code names the physical key, so it tells the two Shifts apart; the key is the character it types.
How the keyboard test works
Every key you press sends the page a keydown event, and a keyup when you let go. Each event carries a code, the key’s position from the W3C list of KeyboardEvent code values, and a key, the character or name it produces with your layout. The drawing lights the key with that code: blue while you hold it, tinted once it has worked.
Because codes name positions, KeyQ is the top-left letter on a QWERTY, AZERTY or QWERTZ keyboard alike, and the drawing works for any language. Choose ANSI (the US shape, with a wide Enter on one row) or ISO (most of Europe: a tall Enter and an extra key beside the left Shift) to match yours.
While you test, the page stops keys like Space, the arrows and F5 from scrolling or reloading it. Some keys never reach a web page: Fn is handled inside most keyboards, and the system can keep shortcuts such as Alt+Tab or the Windows key for itself. Those are not broken keys.
- A USB keyboard using the boot report reports at most six keys at once besides the modifiers (Shift, Ctrl, Alt and the Windows or Command key); a seventh gives a “phantom” rollover error. Source: Device Class Definition for Human Interface Devices (HID).
- A code names a key by position, not character: KeyQ types q on a US keyboard and a on a French one. Source: UI Events KeyboardEvent code Values.
Rollover and ghosting
Rollover is how many keys a keyboard can report at once. Hold keys down one after another and watch the “Most at once” count: when a key you add doesn’t light up, you have found the limit for that combination.
Ghosting is the opposite problem: a key lights up that you didn’t press, because of how the keyboard’s wiring is shared. Many keyboards block the extra key instead, which looks like the same limit. Gaming keyboards often advertise N-key rollover, every key at once.
Key codes for keys people mix up
The code and location a browser reports for each key, from the W3C code values and UI Events.
| Key | code | location |
|---|---|---|
| Left Shift | ShiftLeft | 1 (Left) |
| Right Shift | ShiftRight | 2 (Right) |
| Left Ctrl | ControlLeft | 1 (Left) |
| Windows or ⌘ (left) | MetaLeft | 1 (Left) |
| Alt Gr or right Alt | AltRight | 2 (Right) |
| Enter | Enter | 0 (Standard) |
| Keypad Enter | NumpadEnter | 3 (Numpad) |
| Keypad 5 | Numpad5 | 3 (Numpad) |
| Space bar | Space | 0 (Standard) |
| ISO key beside left Shift | IntlBackslash | 0 (Standard) |
Show all 12 rowsShow fewer
| # ~ on a UK keyboard | Backslash | 0 (Standard) |
| Esc | Escape | 0 (Standard) |
Frequently Asked Questions
How do I check if a key on my keyboard is broken?
Press every key once and look for any that stay grey. A key that doesn’t light at all isn’t reaching the computer. One that lights twice for one press (two lines in the log) is chattering, which usually means a worn switch or dirt under the key.
Why doesn’t the Fn key light up?
Most keyboards handle Fn themselves to switch what the other keys send (volume, brightness), so the computer, and this page, never see it. The same goes for some media keys, which the system handles first.
Is my keyboard ANSI or ISO?
Look at the Enter key. On ANSI keyboards (the US layout) it is one row tall and the backslash sits above it. On ISO keyboards (UK and most of Europe) it is an upside-down L, two rows tall, and there is an extra key between the left Shift and Z.
Why does a key stay lit after I let go?
The page missed its keyup, which happens when the system takes over mid-press: on a Mac, holding ⌘ hides other keys’ keyups, and switching windows does too. The test clears held keys when you let go of ⌘ or leave the window; press Reset to start again.