User Rating 0.0
Total Usage 0 times
Status: Listening...
Press any key to begin...
Event History
Time Key Code Which Loc
Is this tool helpful?

Your feedback helps us improve.

About

This Key Code Event Viewer is a precision diagnostic utility designed for Frontend Engineers and Game Developers who require absolute clarity on browser input events. When building custom controls, hotkeys, or accessibility features, relying on guesswork for event.code or legacy event.keyCode properties leads to cross-browser inconsistencies.

Input handling is complex. A physical keypress triggers a sequence of DOM events with properties that vary based on locale, operating system, and hardware. This tool exposes the entire KeyboardEvent interface in real-time, visualizing the difference between physical location (code) and produced character (key). It specifically addresses the deprecated vs. modern standards dilemma, ensuring your code works across modern Chrome, Firefox, Safari, and legacy environments.

key code javascript events keyboard tester game development input debugging

Formulas

Modern JavaScript relies on distinct properties to handle inputs. The Key represents meaning, while the Code represents physical location.

{
key = "Q" (if QWERTY)key = "A" (if AZERTY)code = "KeyQ" (Always top-left letter)

For game development (WASD movement), always use event.code to ignore user keyboard layouts.

Reference Data

PropertyDescriptionExample ValueStandard Status
e.keyThe value of the key pressed, accounting for modifiers and locale."a", "Enter"Modern
e.codeRepresents the physical key on the keyboard (layout-independent)."KeyA", "Space"Modern
e.whichLegacy numeric code. Inconsistent across browsers.65, 13Deprecated
e.keyCodeLegacy numeric code. Often identical to which.65Deprecated
e.locationIndicates location of the key (Standard, Left, Right, Numpad).0, 1, 2, 3Modern
e.shiftKeyBoolean state of the Shift modifier.TRUEStable

Frequently Asked Questions

e.key represents the character generated (affected by Shift, CapsLock, and Language settings), whereas e.code represents the physical location of the switch on the hardware. For example, pressing the key next to Tab on a US keyboard yields code='KeyQ' and key='q', but on a French keyboard, it yields code='KeyQ' and key='a'.
Neither, if possible. Both are deprecated and inconsistent across browsers. Use e.code for controls (games, hotkeys) and e.key for text input handling. This tool displays the deprecated values only for legacy maintenance.
You must call event.preventDefault() inside your event listener. This tool does this automatically when "Prevent Default" is checked, allowing you to test keys like Tab, F1, and F5 without triggering browser navigation.
Most non-gaming keyboards cannot register more than 3-4 specific keys pressed simultaneously due to hardware wiring matrices. This is a hardware limitation, not a software one. If the tool stops logging new keys while you hold many down, you have hit your hardware's rollover limit.