Key code tester (keycode)
Press any key: you'll instantly see event.key,
event.code, the legacy keyCode and the active modifier keys.
History of recent keys (most recent on the left):
key, code and keyCode: which one should you use?
Modern JavaScript gives you two properties: event.key is the character or
logical name the key produces (for example "a", "A" with Shift, "Enter"), while
event.code identifies the physical position on the keyboard (for example
"KeyA", "Digit1") and stays the same on any layout — QWERTY, AZERTY or Dvorak. Use
key when you care about what the user is typing, and code for
position-based shortcuts, like the WASD keys in games.
Why is keyCode deprecated but still useful?
The numeric keyCode is officially deprecated by the standard, but plenty of
legacy code, plugins and older libraries still check it (the classic 13 for Enter or 27 for
Esc). If you're debugging or maintaining existing code, you need to know which number a key
produces — that's why this tool shows it right next to the modern values, so you can
confidently migrate numeric comparisons to key and code.