Keycode Info
Press any key on your keyboard to see its values below.
Press a key...
event.key
-
event.code
-
event.keyCode
-
event.which
-
Key Location
-
Modifiers
-
How to use this keycode tool
- Click anywhere on this page to make sure it has focus.
- Press any key on your keyboard.
- All the JavaScript event properties for that key appear instantly.
Why does key and code differ?
event.key reflects the character produced (affected by Shift or keyboard layout), while event.code identifies the physical key position regardless of layout — useful for game controls where you want the same physical key to work on any keyboard.
Is keyCode deprecated?
Yes, event.keyCode is a legacy property. Modern code should use event.key or event.code instead, though keyCode still works in all major browsers for compatibility.
Why is my key value empty in the console?
Some special keys (like dead keys used for accents) may produce an empty or "Dead" key value depending on the browser and keyboard layout.