Keyboard Key Code Info
Press any key to see its JavaScript KeyboardEvent properties in real time.
Click here, then press any key
Common Key Reference
| Key | key | code | keyCode |
|---|---|---|---|
| Enter | "Enter" | "Enter" | 13 |
| Escape | "Escape" | "Escape" | 27 |
| Space | " " | "Space" | 32 |
| Tab | "Tab" | "Tab" | 9 |
| Backspace | "Backspace" | "Backspace" | 8 |
| Delete | "Delete" | "Delete" | 46 |
| ArrowUp | "ArrowUp" | "ArrowUp" | 38 |
| ArrowDown | "ArrowDown" | "ArrowDown" | 40 |
| ArrowLeft | "ArrowLeft" | "ArrowLeft" | 37 |
| ArrowRight | "ArrowRight" | "ArrowRight" | 39 |
| Home | "Home" | "Home" | 36 |
| End | "End" | "End" | 35 |
| PageUp | "PageUp" | "PageUp" | 33 |
| PageDown | "PageDown" | "PageDown" | 34 |
| Shift | "Shift" | "ShiftLeft" | 16 |
| Ctrl | "Control" | "ControlLeft" | 17 |
| Alt | "Alt" | "AltLeft" | 18 |
| Meta / ⌘ | "Meta" | "MetaLeft" | 91 |
| F1 | "F1" | "F1" | 112 |
| F5 | "F5" | "F5" | 116 |
| F12 | "F12" | "F12" | 123 |
| A | "a" | "KeyA" | 65 |
| Z | "z" | "KeyZ" | 90 |
| 0 | "0" | "Digit0" | 48 |
| 9 | "9" | "Digit9" | 57 |
What Is This Tool?
When handling keyboard events in JavaScript, you often need to know the exact property values fired by a specific key. This tool listens to your keyboard in real time and displays every property from the KeyboardEvent object — includingkey, code, keyCode, which,charCode, location, and all modifier states.
How to Use
- Click the input area to focus it, then press any key
- All KeyboardEvent properties appear instantly
- Use the reference table below for common key values without pressing them
Key Property Differences
- key — the logical key value (e.g.
"a","Enter","ArrowUp"). Use this for most modern code. - code — the physical key position (e.g.
"KeyA","ShiftLeft"). Layout-independent. - keyCode — legacy numeric code. Deprecated but still widely supported.
- which — alias for keyCode on keyboard events. Deprecated.
- charCode — character code for printable characters. Deprecated; always 0 on keydown.
FAQ
Which property should I use in modern JavaScript?
Use event.key for most cases — it gives you the human-readable key name and is locale-aware. Use event.code when you need the physical key position regardless of keyboard layout (e.g. WASD game controls where you want the same physical keys even on AZERTY keyboards).
What is the difference between keydown, keypress, and keyup?
keydown fires first, when the key is pressed. keyup fires when released. keypress is deprecated — it only fires for printable characters and is not reliable for special keys. Prefer keydown for handling keyboard shortcuts and keyup for detecting when a key is released.
Why is keyCode deprecated?
keyCode was inconsistent across browsers and keyboard layouts, especially for non-ASCII characters. The key and code properties from the UI Events specification provide a more consistent, readable, and internationalization-friendly API.