Home
KeyCodeInspectorv2.0 Client-Side
Private

JavaScript KeyCode & KeyboardEvent Checker

Interactive keyboard event debugger. Inspect event.key, event.code, keyCode, which, modifier keys, and location values in real-time.

13keyCode / which
Enter / Return
Click here or press any key on your keyboard

Carriage return / Submit line break key.

Mobile & Touchscreen Quick Simulation Keys:
Load Sample Key:
event.keyStandard
Enter
Generated character
event.codePhysical
Enter
Keyboard layout key
keyCode / whichLegacy
13
Deprecated numeric code
event.locationPosition
0 (Standard)
Standard / Left / Numpad

Modifier Flags & Keyboard State

Active toggles glow during keystroke
Shiftfalse
Ctrlfalse
Alt / Optfalse
Cmd / Winfalse
Repeatfalse
IME Compfalse
Caps Lockoff
Num Lockoff

Search & Keycode Lookup

Don't have a physical key? Enter a character, name, or numeric keycode (e.g. "Enter", "13", "Space", "KeyA")

KeyboardEvent Object Attributes
event.key"Enter"
event.code"Enter"
event.which13
event.keyCode13
event.charCode0
event.location0 (0 (Standard))
event.type"keydown"
event.repeatfalse
event.isComposingfalse
event.timeStamp1774000000000 (12:00:00)

Zero-Knowledge Local Execution

All data processing, parsing, and compilation execute strictly inside your local browser memory. Zero external server uploads.

Instant Client-Side Engine

Instant real-time reactive computation delivers immediate feedback on every keystroke with zero network latency.

Production Standards & Compliance

Strictly validates syntax, edge cases, and formatting rules for dependable production output.

Technical Reference & Architecture Guide

Key Code Checker Developer Reference

Technical reference for DOM KeyboardEvent properties, legacy keyCode migration, and cross-platform key detection.

Key Code Checker Developer Reference — Client-Side In-Memory Architecture & Data Flow
Key Code Checker Developer Reference — Client-Side In-Memory Architecture & Data Flow

Key Parameters & Controls

Key Parameters & Controls
ParameterType / UnitDescriptionDefault
event.keystringSemantic character value or functional identifier produced by the keystroke (e.g., 'Enter', 'a', 'ArrowDown').""
event.codestringPhysical key identifier representing hardware button placement, unaffected by active layout or modifiers (e.g., 'KeyA', 'Space').""
event.keyCodenumberLegacy system-dependent virtual key code representing the physical or virtual key (deprecated in W3C UI Events).0
event.locationnumberNumeric indicator of key area: 0 (Standard), 1 (Left modifier), 2 (Right modifier), 3 (Numpad).0
event.isComposingbooleanFlag indicating whether the event occurs within an active Input Method Editor (IME) text composition session.false

Pro Tips & Best Practices

Modernize UI Events Handling

Migrate legacy keyboard listeners from deprecated 'keyCode' and 'which' to W3C-standard 'key' and 'code' to ensure cross-platform consistency across modern browsers.

Prevent IME Submission Flaws

Check 'event.isComposing' or guard against 'event.keyCode === 229' to avoid premature form submissions when international users confirm input with the Enter key.

Layout-Independent Game Controls

Bind position-dependent gaming controls (such as WASD navigation) to 'event.code' rather than 'event.key' so key positions remain invariant across QWERTY, AZERTY, and Dvorak.

Common Gotchas & Troubleshooting

⚠️KeyboardEvent.keyCode returns 229 on mobile virtual keyboards and desktop IME input.

Inspect 'event.isComposing' before executing key actions, or migrate text-entry handling to the standard DOM 'input' event with 'event.inputType'.

⚠️Position-sensitive shortcut keys trigger incorrect actions on international keyboard layouts like AZERTY.

Use 'event.code' (e.g. 'KeyW') for spatial hotkeys and 'event.key' (e.g. 'z' or 'w') when listening for semantic character input.

Frequently Asked Questions

Why are KeyboardEvent.keyCode and KeyboardEvent.which deprecated by the W3C?▼

Both properties are inconsistent across operating systems, browsers, and international keyboards, returning ASCII-derived legacy integers that cannot reliably distinguish between layouts or compose non-Latin characters. The W3C UI Events specification supersedes them with standard 'key' and 'code' properties.

How do KeyboardEvent.key and KeyboardEvent.code behave differently across keyboard layouts?▼

'KeyboardEvent.code' represents the immutable physical key position on the keyboard hardware (e.g., 'KeyQ' on both QWERTY and AZERTY), while 'KeyboardEvent.key' reflects the resolved character string produced in the current active layout (e.g., 'q' on QWERTY vs. 'a' on AZERTY).

What does KeyboardEvent.location indicate in DOM key events?▼

'KeyboardEvent.location' specifies the physical keyboard region: 0 (DOM_KEY_LOCATION_STANDARD), 1 (DOM_KEY_LOCATION_LEFT, e.g. Left Shift), 2 (DOM_KEY_LOCATION_RIGHT, e.g. Right Shift), 3 (DOM_KEY_LOCATION_NUMPAD), and extended vendor values like 4 (Mobile) or 5 (Joystick).

How should single-page applications handle keyboard shortcut registration without memory leaks?▼

Attach key listeners to 'window' or specific focusable DOM containers using 'addEventListener('keydown', handler)' inside a lifecycle hook (e.g., 'useEffect'), and always supply 'removeEventListener' in the teardown cleanup function. Use 'event.preventDefault()' sparingly to avoid disabling essential accessibility and navigation behaviors.