JavaScript KeyCode & Keyboard Event Tester

Press any key on your keyboard to instantly see its JavaScript event.key, event.code, keyCode, and modifier states.

  • 100% free
  • Private in browser
  • No signup
  • No watermarks
Press any key on your keyboard

13

event.key:"Enter"event.code:"Enter"
event.key

Enter

event.code

Enter

event.which

13

event.location

Standard (0)

Modifier Keys:
Shift: NOCtrl: NOAlt / Option: NOCmd / Meta: NO

Rate this tool

Be the first to rate โ€” helps others and improves this page.

About JavaScript KeyCode & Keyboard Event Tester

The JavaScript KeyCode & Keyboard Event Checker helps frontend web developers, game programmers, and accessibility engineers build responsive keyboard navigation. Simply press any physical key or key combination to inspect exact DOM KeyboardEvent properties including standard modern event.key and event.code alongside legacy numeric keyCode values.

How to use JavaScript KeyCode & Keyboard Event Tester

  1. Press any key or key combination on your physical keyboard.
  2. Inspect the prominent numeric keyCode card and modern event.key string.
  3. Check modifier key states (Shift, Control, Alt, Command/Meta).
  4. Review the event log history to compare consecutive key presses.

Key features

  • Real-time live DOM keydown and keyup event listener
  • Displays modern `event.key`, `event.code`, legacy `event.keyCode`, and `event.which`
  • Active indicator flags for Shift, Ctrl, Alt/Option, and Meta/Cmd modifier keys
  • Interactive event history log keeping track of the last 15 pressed keys

Frequently asked questions

What is the difference between event.key and event.code?
`event.key` returns the printed character value generated by the key press taking keyboard layout and Shift into account (e.g. "a" vs "A" or "@"). `event.code` identifies the physical key location on the keyboard regardless of language layout (e.g. "KeyA", "Digit2").
Why is event.keyCode deprecated in modern web standards?
The legacy `event.keyCode` property was inconsistently implemented across different browsers and international keyboard layouts. The W3C modern standard recommends using `event.key` for character values and `event.code` for physical key coordinates.
Does this tool detect function keys and special keys like Escape or Enter?
Yes. Function keys (F1โ€“F12), navigation keys (ArrowUp, PageDown, Home, End), and modifier keys are all detected accurately with their respective codes.
Can I test key combinations like Ctrl+C or Cmd+Shift+Z?
Yes. The tool actively monitors the boolean states of `ctrlKey`, `metaKey`, `shiftKey`, and `altKey` so you can test shortcut triggers.
Is my keystroke data private?
Yes. Keystrokes are captured strictly within local browser DOM memory and are never transmitted across the network or stored in any database.