Keyboard Event Viewer

Show key, code, keyCode and modifiers for each keypress.

The Keyboard Event Viewer shows what the browser reports when you press a key. It lists key, code, the deprecated keyCode, location, modifiers and the repeat flag, and keeps a short history of recent presses. Use it when you write keyboard shortcuts, debug game controls or handle international layouts.

What is a keyboard event?

When you press a key, the browser fires a keydown event on the focused element, carrying several properties. event.key is the value the key produces, such as a, A, Enter or ArrowLeft, and it depends on layout and modifier state. event.code identifies the physical key, such as KeyA or Digit1, regardless of layout, which makes it the right choice for game-style controls. event.keyCode is an older numeric code that is deprecated but still seen in legacy code. event.location tells whether a key is standard, left, right or on the numpad, which separates the two Shift keys or the numpad digits from the top row. event.repeat is true when the key is held down and the browser sends repeated events.

How to use Keyboard Event Viewer

  1. Focus the area Click the box that says Click here, then press any key.
  2. Press a key The large display shows the key, and a panel lists event.key, event.code, event.keyCode (deprecated), event.location, Modifiers and event.repeat.
  3. Review the history A table lists time, key, code, keyCode and modifiers for up to 20 recent presses.
  4. Clear Press Clear history to remove the table and the current reading.

Frequently asked questions

What is the difference between key and code?

key is the value the key produces and depends on layout and modifiers. code names the physical key position and is independent of the layout.

Why is keyCode marked deprecated?

It is a legacy numeric property with inconsistent values across browsers and layouts. Modern code should use key or code.

What do the location values mean?

0 is Standard, 1 is Left, 2 is Right and 3 is Numpad, as the page shows next to the number.

Why do some keys behave oddly on mobile?

Virtual keyboards often do not send reliable key and code values, so results can be empty or generic.

Does it record what I type anywhere?

No. It only listens to key presses while the capture area has focus, and the history stays in the page.

How many past events are kept?

The 20 most recent, not counting repeated events from holding a key.