Keyboard Event & KeyCode Inspector

Press any key to instantly inspect JavaScript KeyboardEvent properties (e.key, e.code, e.keyCode, e.location, modifiers) and test keyboard keys.

Press any key on your keyboard
13
event.keyCode / event.which
event.key
Enter
Printed character / key name
event.code
Enter
Physical key code
event.location
0 (Standard / 标准按键)
Key location on device
Active Modifiers
CtrlShiftAlt / OptionMeta / ⌘ / Win
Recent Keystroke History
Enter

About Keyboard Event & KeyCode Inspector — Detailed Guide

The KeyCode Info and Keyboard Event Tester captures JavaScript `KeyboardEvent` attributes in real time whenever you press any physical key. It displays both modern properties (`event.key`, `event.code`) and legacy properties (`event.keyCode`, `event.which`).

Featuring an interactive full-keyboard matrix, the tool highlights triggered keys in real time, tracks key event history, and verifies keyboard switch health—making it ideal for debugging web hotkeys and testing hardware switches.

#keycode #keyboard #event #key #code #which #tester

Key Features & Capabilities

  • Instant display of event.key, event.code, event.keyCode, and event.which upon keydown
  • Live tracking of modifier keys (Shift, Ctrl, Alt, Meta / Command / Windows)
  • Interactive full-sized virtual keyboard highlighting pressed keys and verifying switch health
  • Reports physical key location (Standard, Left, Right, Numpad) with one-click property copying

How to Use

  1. 1

    Click anywhere on the tool page to ensure browser window focus.

  2. 2

    Press any physical key or modifier combination (e.g., Shift+K, Escape, Enter).

  3. 3

    Inspect the real-time event attributes on the dashboard and click to copy.

Common Use Cases

  • → Implementing global web hotkeys (e.g. Esc to close drawers, Ctrl+Enter to submit forms)
  • → Testing mechanical keyboards for phantom ghosting, chatter, or unresponsive switches
  • → Resolving cross-platform modifier key discrepancies between Windows and macOS systems

Related Tools

Frequently Asked Questions & Privacy

Why is `event.keyCode` deprecated in modern web standards?

`keyCode` returns inconsistent numeric values across operating systems and international keyboard layouts. Modern standards mandate using `e.key` (character) and `e.code` (physical location).

What is the exact difference between `e.key` and `e.code`?

`e.code` identifies the physical hardware key on the keyboard (e.g., `"KeyA"`), regardless of layout or shift state. `e.key` identifies the resulting character (e.g., `"a"` or `"A"`).