Key Code Finder — Find event.key, event.code and Key Codes
Different keyboard APIs call the same key by different names: the physical position (code), the produced character (key) and the legacy numeric keyCode. This page reads them all from your actual keyboard, including layout differences between languages.
Quick answer: Press the key you care about: the page shows event.code (physical position, layout independent), event.key (the character produced), and the legacy keyCode and location. Copy the value your code expects — modern handlers should use code for position and key for the character.
| Values shown | event.code, event.key, legacy keyCode, which modifier state, and location (left/right) |
|---|---|
| Layout independent | event.code is tied to the physical position — KeyQ is the same key on AZERTY and QWERTY |
| Good for | Writing keyboard shortcuts, game keybinds, key remappers and accessibility tools |
| History | The numeric keyCode is deprecated but still common in older code and tutorials |
code vs key vs keyCode — which one to use
Use event.code when the physical key matters (WASD movement, a game that cares where the key is). Use event.key when the character matters, such as typing or shortcuts that should follow the user's layout. The legacy keyCode numbers are layout-dependent and deprecated, but you will still meet them in older code — this page shows them side by side so you can match whatever your project expects.
When to use this test
- Writing a keyboard shortcut and need the exact code to listen for
- A key produces a different character on a different language layout and you need to handle both
- Rebuilding a key bind in a script or a web game
- Debugging why a shortcut fires when the numpad is used but not the number row