Keycode Info
Client-Side SecureFree online Keycode Info. Get JavaScript event keycodes, code, and key values instantly by pressing any key. Essential tool for web developers.
Press Any Key
Focus this window and type to reveal JavaScript event codes.
Is this tool broken?
Let us know if you found a bug or have a feature request.
JavaScript KeyCode Event Info
Press any key to instantly view its event.key, event.code, event.which, and modifier states.
This tool is essential for web developers debugging keyboard shortcuts, game controls, and accessibility features. It captureskeydown events in real-time.
Key vs Code
event.key: The character generated (e.g. "a" or "A"). Use this for text input.
event.code: The physical key on the keyboard (e.g. "KeyA"). Use this for game controls (WASD) so they work on any keyboard layout (QWERTY, AZERTY, etc.).
Deprecated Values
Avoid using event.keyCode, event.which, and event.charCode. They are inconsistent across browsers and deprecated in modern web standards. Always prefer key or code.
Common Key Codes
| Key | Code | Deprecated (which) |
|---|---|---|
| Backspace | Backspace | 8 |
| Tab | Tab | 9 |
| Enter | Enter | 13 |
| Shift | ShiftLeft | 16 |
| Escape | Escape | 27 |
| Space | Space | 32 |
FAQ
Why is event.which 0?
On some modern browsers or mobile devices (especially Android virtual keyboards),keyCode and which may report 0 or 229 for all keys. This is known as the "composition" issue. Always rely on event.key for text input.
How to detect Command vs Control?
Use the event.metaKey property to detect the Command (⌘) key on macOS, and event.ctrlKey for Control on Windows/Linux.
You might also like
Free online Keyboard Test. Check for ghosting, key rollover, and broken keys on your mechanical or laptop keyboard. Instant visual feedback.
Free online Diff Checker. Compare text, code, or JSON files side-by-side to find differences. Highlight changes.
Free online JSON to TypeScript Converter. Automatically generate TypeScript interfaces from your JSON objects. Save time and reduce errors.