Skip to content

Discover JavaScript key codes, code identifiers, locations, and keyboard event properties in real time.

Loading tool

About Keycode info

Press any key to see the KeyboardEvent properties the browser fires for it: event.key, event.code, the legacy keyCode and which values, the character code, key location (standard, left, right or numpad), active modifiers, and the repeat and isComposing flags. The last 25 presses are kept in a history table so you can compare keys side by side.

Common uses

  • Find the event.code to use for a keyboard shortcut handler
  • Tell left and right Shift, Ctrl or Alt apart using event.location
  • Check what a key reports on a non-US keyboard layout
  • Look up the legacy keyCode needed by older code

FAQ

What is the difference between event.key and event.code?
event.key is the value the key produces with the current layout and modifiers (for example 'a', 'A' or 'Enter'). event.code identifies the physical key position (for example 'KeyA'), regardless of layout.
Is keyCode deprecated?
Yes. KeyboardEvent.keyCode and which are deprecated; new code should use event.key or event.code. Browsers still populate keyCode for compatibility.
Why do some shortcuts not show up?
Some combinations are captured by the operating system or the browser before the page sees them, such as Ctrl+W or Cmd+Tab, so no keydown event reaches the page.