DeviceTest

Key Code Finder — Find event.key, event.code and Key Codes

Different keyboard APIs call the same key by different names: the physical position (code), the produced character (key) and the legacy numeric keyCode. This page reads them all from your actual keyboard, including layout differences between languages.

Quick answer: Press the key you care about: the page shows event.code (physical position, layout independent), event.key (the character produced), and the legacy keyCode and location. Copy the value your code expects — modern handlers should use code for position and key for the character.

Esc
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
`
1
2
3
4
5
6
7
8
9
0
-
=
Backspace
Tab
Q
W
E
R
T
Y
U
I
O
P
[
]
\
Caps
A
S
D
F
G
H
J
K
L
;
'
Enter
Shift
Z
X
C
V
B
N
M
,
.
/
Shift
Ctrl
Win
Alt
Space
Alt
Win
Menu
Ctrl
Num
/
*
-
7
8
9
+
4
5
6
1
2
3
Enter
0
.
Press any key to see its code. Click the pad first so the page has focus.
Core facts
Values shownevent.code, event.key, legacy keyCode, which modifier state, and location (left/right)
Layout independentevent.code is tied to the physical position — KeyQ is the same key on AZERTY and QWERTY
Good forWriting keyboard shortcuts, game keybinds, key remappers and accessibility tools
HistoryThe numeric keyCode is deprecated but still common in older code and tutorials

code vs key vs keyCode — which one to use

Use event.code when the physical key matters (WASD movement, a game that cares where the key is). Use event.key when the character matters, such as typing or shortcuts that should follow the user's layout. The legacy keyCode numbers are layout-dependent and deprecated, but you will still meet them in older code — this page shows them side by side so you can match whatever your project expects.

When to use this test

  • Writing a keyboard shortcut and need the exact code to listen for
  • A key produces a different character on a different language layout and you need to handle both
  • Rebuilding a key bind in a script or a web game
  • Debugging why a shortcut fires when the numpad is used but not the number row

Frequently asked questions

Frequently Asked Questions

Why do the numpad keys and the number row give different codes?
They are physically different keys. The number row sends Digit1 while the numpad sends Numpad1, which is exactly why games let you bind them separately.
What is the difference between ShiftLeft and ShiftRight?
The location of the key. Historically many keyboards report both as Shift; modern browsers expose the side, which matters for games that bind one shift for sprint and the other for walk.
Dead keys and special characters do not show a character. Why?
Composition keys (accents, CJK input methods) produce composition events rather than a plain character, so event.key can be 'Dead' or 'Process'. The code and keyCode values are still shown so you can bind around them.

More keyboard and gamepad tests

More guides