JavaScript Keycode Finder | Keyboard Event Inspector

Press any key to inspect JavaScript keyboard event values such as key, code, which, location, and modifier states.

Press any key to start...
Keycode (event.which)
0
Key (event.key)
-
Location (event.location)
-
Code (event.code)
-
Modifiers
Ctrl Shift Alt Meta

Inspect JavaScript Keyboard Events

Press a key and see event.key, event.code, legacy keyCode and which values, location, and active modifiers. It helps debug shortcuts, games, forms, and keyboard-driven UI.

Understand Modern and Legacy Values

Modern JavaScript should usually rely on key and code, while keyCode and which remain useful when reviewing older scripts or browser behavior.

When Key Testing Helps

Use it while building hotkeys, accessibility controls, input masks, command palettes, keyboard navigation, and cross-browser event handling.

About This Tool

Keycode Info shows the keyboard event properties for any key you press: keyCode, key, code, and modifier states. It is used by developers to debug keyboard event handlers and find the correct values for key detection.

When to Use It

Use this when writing a keyboard shortcut handler and you need the exact key string or keyCode for a specific key, when debugging why a keyboard event is not firing, or when mapping non-standard keys.

How to Use

  1. Click in the detection area.
  2. Press the key or combination you want to inspect.
  3. Review the event properties: key, code, keyCode, and modifiers.
  4. Copy the values you need for your event handler.

Frequently Asked Questions

Should I use keyCode or key in event handlers?

Use event.key for modern code. It returns a descriptive string like 'Enter' or 'ArrowUp'. keyCode is deprecated but still widely supported for compatibility.

What is the difference between key and code?

key reflects the character produced by the key with current modifier state. code reflects the physical key position regardless of keyboard layout.

Why do some keyboard shortcuts not work in browsers?

Some keys and combinations are reserved by the browser or OS. F5, Ctrl+T, and Ctrl+W cannot be overridden in most browsers.