JavaScript KeyboardEvent inspector

Keyboard Event Tester

Use this keyboard event tester to inspect the JavaScript event data generated by each key press in your browser.

Quick Answer

A keyboard event tester captures browser keydown events and displays the KeyboardEvent properties developers commonly need: event.key, event.code, keyCode, which, location, repeat, and modifier keys.

Live Keyboard Event Tester

Press any key to capture the current keydown event and inspect the values your JavaScript handler would receive.

Current key press

Waiting...

Press any key to start

event.key

-

Value produced by the key

event.code

-

Physical keyboard position

event.keyCode

-

Legacy numeric value

event.which

-

Legacy alias

event.location

-

Left, right, or numpad hint

event.repeat

-

True when held down

Modifier Keys

Waiting

Shift, Ctrl, Alt, Meta

Common Uses

  • Compare keydown event values across browsers.
  • Debug keyboard shortcuts, command palettes, and game controls.
  • See how virtual keyboards and physical keyboards report input.
  • Check whether a key reports a layout-dependent value.

Event Values to Watch

event.key

The typed character or semantic key name, such as A, Enter, or ArrowLeft.

event.code

The hardware key code for the physical position on the keyboard.

event.location

A numeric hint for left/right modifiers or numpad keys when browsers provide it.

event.repeat

Whether the keydown event is repeating because the key is being held down.

Frequently Asked Questions

Which keyboard event does this page test?

This page listens for keydown events because keydown is the most useful event for shortcuts, key detection, and most interactive keyboard behavior.

Is keypress still the right JavaScript event to use?

For new code, keydown and keyup are usually preferred. The legacy keypress event is limited and has been replaced by more consistent KeyboardEvent properties.

Why should I test keyboard events in the browser?

Testing in the browser shows the exact values your JavaScript receives, which helps avoid layout, modifier, browser, and deprecated keyCode surprises.

Related Keyboard Event Guides