JavaScript Keycode Tester & Event Inspector
Press any key on your keyboard to instantly view JavaScript KeyboardEvent properties, code, and keyCodes.
Press any key on your keyboard…
Focus this box or anywhere on the page and hit a key
CtrlShiftAlt / OptionMeta / Cmd / Win
JavaScript Keycode Reference Search
| Key Name | event.code | event.keyCode |
|---|---|---|
| Backspace | Backspace | 8 |
| Tab | Tab | 9 |
| Enter | Enter | 13 |
| Shift | ShiftLeft / ShiftRight | 16 |
| Control | ControlLeft / ControlRight | 17 |
| Alt / Option | AltLeft / AltRight | 18 |
| Pause / Break | Pause | 19 |
| Caps Lock | CapsLock | 20 |
| Escape | Escape | 27 |
| Space | Space | 32 |
| Page Up | PageUp | 33 |
| Page Down | PageDown | 34 |
| End | End | 35 |
| Home | Home | 36 |
| Arrow Left | ArrowLeft | 37 |
| Arrow Up | ArrowUp | 38 |
| Arrow Right | ArrowRight | 39 |
| Arrow Down | ArrowDown | 40 |
| Insert | Insert | 45 |
| Delete | Delete | 46 |
| Digit 0 - 9 | Digit0..Digit9 | 48 - 57 |
| Key A - Z | KeyA..KeyZ | 65 - 90 |
| Windows / Meta | MetaLeft / MetaRight | 91 |
| F1 - F12 | F1..F12 | 112 - 123 |
How the keycode tester works
This tool listens for keydown events on the page and displays all properties from the KeyboardEvent object: event.key (the printable character or key name), event.code (the physical key position), keyCode / which (legacy numeric codes, still used in many codebases), and the four modifier-key booleans. Use event.key and event.code in modern code — keyCode is deprecated but still needed for older browser compatibility.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Finding the right `event.key` value for a keyboard shortcut.
- Checking whether `key` or `code` is the correct property for your case.
- Debugging a shortcut that fires on one keyboard layout and not another.
- Inspecting modifier state alongside the key.
- Checking what a media or a function key reports.
Frequently Asked Questions
- Which property should I use — key, code or keyCode?
- `key` for the character produced and `code` for the physical key. `keyCode` is deprecated and inconsistent across browsers, and it is still the one most tutorials show — which is why so much keyboard handling breaks on non-US layouts.
- What is the difference between key and code?
- `code` is the physical position — `KeyA` is the key where A sits on a US layout, regardless of what it types. `key` is what it actually produced, which on a French AZERTY layout is `q` for that same physical key.
- Which should a game use?
- `code`, because WASD is a physical shape. Using `key` means a French keyboard player has to press ZQSD to move in the same pattern, which is the classic bug in browser games ported without layout testing.
- Why is keypress deprecated?
- Because it never fired for non-character keys and its behaviour differed across browsers for everything else. `keydown` plus the `key` property covers what it did, and `beforeinput` covers text entry more reliably including from IME and paste.
- Why does my shortcut not fire on some keyboards?
- Usually a modifier or a layout difference. `Ctrl+/` requires Shift on several European layouts, so the event arrives with a different `key` — which is why matching on `code` plus modifiers is more robust for shortcuts than matching on the character.
Common errors and gotchas
- Using the deprecated `keyCode`, which is inconsistent across browsers and no longer specified.
- Using `code` for a character shortcut, which reports the physical key and ignores layout.
- Using `key` for a positional shortcut such as WASD, where layout changes the character.
- Assuming a key combination is available, when the browser or OS may claim it first.
- Testing on one layout and shipping a shortcut that is unreachable on another.
Related Developer Utilities tools
RegExp Tester
Test regular expressions and inspect matches locally.
Regex Visualizer
Visual regex pattern diagram with live match highlighting and capture group annotations.
Subnet Calculator
Compute CIDR subnets, usable hosts, and network ranges.
Cron Parser
Translate cron syntax into plain English.
URL Parser
Break a URL into protocol, host, path, and query parts.
HTML Previewer
Paste HTML and see it rendered live in a safe, sandboxed preview.
HTTP Status Code Reference
Search and look up every HTTP status code and its meaning.
MIME Type Lookup
Find the MIME type for a file extension, or the extensions for a MIME type.