Keycode info
Press any key to see its keyCode, code, location and other details — useful when wiring up keyboard shortcuts.
Find the javascript keycode, code, location and modifiers of any pressed key.
Steps and notes
What is Keycode info?
Press any key and see everything the browser tells you about the event: the legacy keyCode, the modern code (physical key), key (produced character), location and active modifiers. The fastest way to resolve "which value do I compare against" while wiring a keyboard shortcut or a game control scheme.
- Focus the page
- Press the key you want to inspect
- Read the details shown below
- keyCode is deprecated; prefer event.code or event.key in new code
Frequently asked questions
- Is keyCode deprecated?
- Yes — the spec marks it legacy and new code should use KeyboardEvent.code for physical keys or KeyboardEvent.key for characters. It is kept here because countless existing libraries and tutorials still compare against it.
- What is the difference between key and code?
- key is what the character produces and changes with layout and modifiers (Shift+1 gives "!"); code is the physical button regardless of layout (Digit1 in both cases). Shortcuts belong on code; text input belongs on key.
- Why do some keys differ between platforms?
- Physical layouts vary (ISO vs ANSI Enter, Mac Command vs Windows key) and location distinguishes left/right modifiers. Testing the real key on the target platform avoids surprises.
Category: Web