Press any key to identify it and inspect the values sent by the browser in the keydown and keyup events. The tester displays key, code, the legacy keyCode, location, repeat, and the modifier properties ctrlKey, shiftKey, altKey, and metaKey. Everything runs locally in your browser.
keydown eventkeyup eventA physical key produces a keydown event when pressed and a keyup event when released. This page records both, making it useful for debugging keyboard shortcuts, games, forms, accessibility controls, and unusual keyboards.
| Property | Meaning |
|---|---|
key |
The character or action produced, such as a, A, or Enter. |
code |
The physical key position, such as KeyA or NumpadEnter. |
keyCode |
A legacy numeric value. It is shown for compatibility, but should not be used in new code. |
location |
Distinguishes the standard, left, right, and numeric-keypad locations. |
repeat |
Becomes true when a held key starts repeating. |
| Modifiers | ctrlKey, shiftKey, altKey, and metaKey report active modifier keys. |
key vs. code vs. keyCodeUse key when the resulting character or action matters. For example, the same physical key may return z on QWERTZ and y on QWERTY. Use code when the physical position matters, as in game controls. The keyCode and which properties are deprecated and can vary between browsers and platforms.
| Key | key |
code |
Legacy keyCode |
|---|---|---|---|
| Enter | Enter |
Enter |
13 |
| Escape | Escape |
Escape |
27 |
| Space | " " |
Space |
32 |
| Arrow left | ArrowLeft |
ArrowLeft |
37 |
| Arrow up | ArrowUp |
ArrowUp |
38 |
| Arrow right | ArrowRight |
ArrowRight |
39 |
| Arrow down | ArrowDown |
ArrowDown |
40 |
| A | a or A |
KeyA |
65 |