Inspect keyboard events
Press any key to see exactly what your browser receives: key, code, keyCode, location and more.
This keyboard test needs JavaScript. Turn it on in your browser settings to test your keys; the guide below works without it.
| Type | key | code | location | repeat | isComposing | keyCode | ms |
|---|
This keycode tester lists every keydown and keyup with its key, code, keyCode and location, so you can use it as a keyboard event viewer, a keypress tester and a key press detector while you build shortcuts or games.
What each value means
| Property | Example | Meaning |
|---|---|---|
key | "a", "A", "Enter" | The character or action the key produces with the current layout and modifiers. |
code | "KeyA", "ShiftLeft" | The physical key position, independent of the input language. Use it for games and shortcuts based on position. |
keyCode | 65 | A legacy number. It is deprecated and differs between browsers and layouts. Shown for older code only. |
location | 0 to 3 | 0 standard, 1 left, 2 right, 3 numeric keypad. |
repeat | true | The event comes from auto-repeat while a key is held. |
isComposing | true | The key is part of input-method composition, for example Japanese or Chinese typing. |
How to use the keycode tester
Click the event panel or just press a key. The top panel shows the latest key down; the table lists every keydown and keyup with the time since the previous event. Space, Tab and the arrow keys stay on this page while the panel is active; press Esc to release them.
Use Pause to freeze the log, Clear to start again and Copy log to paste the table into a bug report. The log can contain the characters you typed, so check it before you share it.
key or code: which one to use
Use code when the position matters, for example WASD movement that should stay in the same place on an AZERTY keyboard. Use key when the meaning matters, for example a shortcut that should follow the letter printed on the keycap. Avoid keyCode and which in new code: they are kept only for compatibility.
During input-method typing many browsers send keyCode 229 and isComposing: true. Handle those events separately, or wait for the composition to finish.
Keys that send nothing
If a key produces no event at all, the keyboard or the operating system handled it. That is normal for Fn, power and many media keys. A key that shows an empty code or Unidentified is sending a signal the browser does not recognise; it is not a physical position this tool can name.
Common legacy keyCode values
Older code and tutorials still use keyCode. These values are the same in current desktop browsers for a US layout; letters and digits stay the same on most other layouts, while punctuation keys may differ.
| Key | keyCode | code |
|---|---|---|
| Backspace | 8 | Backspace |
| Tab | 9 | Tab |
| Enter | 13 | Enter / NumpadEnter |
| Shift, Ctrl, Alt | 16, 17, 18 | ShiftLeft, ControlLeft, AltLeft (and Right) |
| Escape | 27 | Escape |
| Space | 32 | Space |
| Arrow left, up, right, down | 37, 38, 39, 40 | ArrowLeft … ArrowDown |
| 0–9 (number row) | 48–57 | Digit0 … Digit9 |
| A–Z | 65–90 | KeyA … KeyZ |
| Numpad 0–9 | 96–105 | Numpad0 … Numpad9 |
| F1–F12 | 112–123 | F1 … F12 |
Checking shortcuts in your own app
When a shortcut does not fire, press it here first. If the event never appears, the browser or the system took the shortcut before your page could see it, and no code change will help: choose another combination. If the event appears but with an unexpected key, your code probably compares the character instead of the position; switch the comparison to code. If repeat is true on the events you handle, ignore repeats so a held key does not trigger the action many times.
Frequently asked questions
What is the difference between key and code?
key is the character or action, which changes with your keyboard language and Shift. code is the physical key position, which stays the same in any language.
Is keyCode deprecated?
Yes. keyCode is a legacy property kept for compatibility. Use key or code in new JavaScript.
Why does every key show keyCode 229?
An input method is active, such as a Chinese, Japanese or Korean keyboard. Switch to direct input to see normal values.
Is anything I type sent to a server?
No. The log is kept in this tab only. Copy log puts it on your clipboard and nowhere else.