⌨️ KeyCode Info
Press any key to instantly see its JavaScript keyCode, code, key, which, location and modifier values. Includes a shortcut builder. Free, private, no signup.
🎯 Shortcut Builder
UniquePress any key combination — Ctrl+Shift+K, Alt+F4, Cmd+Z — and get both a human-readable string and a raw developer format. Copy either for use in documentation or event handler code.
About This KeyCode Info Tool
This keycode info tool gives JavaScript developers instant access to every property of a keyboard event.
Press any key and you immediately see e.key, e.code, e.keyCode,
e.which, e.location, and modifier state — all in one place. Whether you are
debugging keyboard event handlers, building accessibility features, or testing input validation, having
accurate keycode info at your fingertips eliminates the need for console.log-driven testing.
Unlike basic key inspection tools, this keycode info checker also includes a Shortcut Builder — a unique feature for developers who need to document or reproduce multi-key combinations. Press Ctrl+Shift+K or Alt+F4 and the builder immediately outputs both a human-readable string ("Ctrl + Shift + K") and the raw property string for direct use in event handler conditions. No other free keycode info resource provides this side-by-side output.
What Each Value Means
- key — The logical character or key name ("a", "Enter", "ArrowLeft") — locale and layout aware
- code — Physical key identifier ("KeyA", "Enter") — consistent across keyboard layouts, best choice for shortcuts
- keyCode — Legacy numeric value (65 for "a"). Deprecated but present in virtually all production codebases
- which — Older numeric alias for keyCode; returns identical values for keyboard events
- location — 0 = Standard, 1 = Left modifier, 2 = Right modifier, 3 = Numpad
- Unicode — Decimal and hexadecimal code point of the character (only meaningful for printable characters)
code vs keyCode — Which Should You Use?
For all new JavaScript development, prefer e.code or e.key.
The e.code property identifies the physical key position regardless of keyboard layout —
essential for games and application shortcuts. The legacy e.keyCode and e.which
are deprecated by the W3C but remain in millions of production codebases. This keycode info tool displays
all four properties simultaneously, making it simple to see exactly how they differ for any key you press.
Modifier Keys and Combinations
Modifier keys — Shift, Ctrl, Alt, and Meta (Cmd on Mac) — are tracked via boolean properties on the
KeyboardEvent: e.shiftKey, e.ctrlKey, e.altKey, e.metaKey.
The keycode info panel highlights active modifiers visually so you can verify combinations at a glance.
The Shortcut Builder captures full combinations and formats them for documentation or code.
Common Developer Uses for KeyCode Info
Keycode info is essential whenever keyboard events drive application logic. Typical use cases include:
- Building keyboard shortcuts in web apps and SPAs
- Validating which key triggered a form submission or modal close
- Implementing game controls that need multi-key and modifier detection
- Creating accessible interfaces that respond to keyboard navigation events
- Debugging existing key event listeners in legacy codebases
- Documenting shortcut tables for user-facing products and design systems
This keycode info tool runs entirely in your browser using native KeyboardEvent — no libraries,
no server calls, and no data ever leaves your device.
Frequently Asked Questions
What is a keycode in JavaScript?
A keycode in JavaScript is a numeric value returned by the e.keyCode property of a KeyboardEvent. This keycode info covers the full set of event properties — key, code, keyCode, which, and location — that fire when a user presses a key. Use the tool above to instantly look up any value without writing test code.
How do I find the keycode of any key?
Simply press the key on this page. The keycode info tool instantly displays all keyboard event properties including keyCode, which, code, key, and Unicode value. You can also use browser DevTools: open the console and type document.addEventListener('keydown', e => console.log(e)), then press your key to see the full event object.
What is the difference between keyCode, which, and code in JavaScript?
e.keyCode and e.which are legacy numeric properties returning the same value for most keys (e.g. 65 for "a"). e.code returns a string identifying the physical key position ("KeyA") regardless of layout. e.key returns the actual character or key name ("a", "Enter", "ArrowLeft"). For new code, always prefer e.code or e.key.
Are keyCode and which deprecated?
Yes. Both e.keyCode and e.which are officially deprecated in the Web standard and may be removed from browsers in the future. However, they remain widely supported and appear in millions of production codebases. This tool shows current values alongside modern alternatives so you can compare them directly and decide what to use.
How do I detect modifier keys like Ctrl, Shift and Alt in JavaScript?
Check the boolean properties on the KeyboardEvent: e.ctrlKey, e.shiftKey, e.altKey, and e.metaKey. Each returns true when that modifier is held. The keycode info tool highlights active modifiers visually so you can verify combinations at a glance. Use the Shortcut Builder panel to capture and copy full key combinations in one click.