TestMyKeyOnline Keyboard Tester
Event & KeyCode Inspector·Real-Time DOM Detection·1-Click Copy

JavaScript Key Identifier

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

Press any key

We'll show you everything your browser knows about it.

event.code vs event.key vs keyCode

Understand which property to use in your JavaScript event handlers.

event.code— Physical key layout position

Physical identifier like 'KeyA', 'Space', 'ArrowUp'. Identical across QWERTY, AZERTY, and Dvorak. Best for games and keybindings.

event.key— Rendered Unicode character

The character typed after modifiers ('a' -> 'A' with Shift, '4' -> '$'). Best for text inputs and typing software.

event.keyCode— Legacy numerical value

Numeric code (e.g. 65 for A). Deprecated but retained for backward compatibility with older libraries.

Mac vs Windows Modifier Map

ActionWindowsMac
Primary modifierCtrlCmd (Meta)
Secondary modifierAltOption (Alt)
Context menuContextMenu—
Line start/endHome / EndCmd + ← / →

Common Key Codes Cheat Sheet

Space32
Enter13
Escape27
Backspace8
Tab9
Shift16

Frequently asked questions

Developer FAQ regarding keyboard events and JavaScript key properties.