Skip to content
DevKit Labs

JavaScript Keycode & Key Event Info

Press any key to see its JavaScript event.key, event.code and keyCode — 100% in your browser.

Press any keyClick this box, then press a key to see its codes.

About JavaScript Keycode & Key Event Info

Press any key and this tool shows exactly what the browser reports for that KeyboardEvent: the modern event.key (the character or key name) and event.code (the physical key), plus the legacy keyCode and which values, the key location (left, right, numpad) and the state of the Ctrl, Alt, Shift and Meta modifiers. A running list keeps your recent keys for quick comparison.

It's the fastest way to find the right values when writing keyboard shortcuts or key handlers in JavaScript. Everything runs locally in your browser — no key presses are sent anywhere.

Pressing the letter A

Input
Press: A
Output
event.key: "a"
event.code: "KeyA"
event.keyCode: 65

Holding Shift changes event.key to "A" but event.code stays "KeyA".

Frequently asked questions

What's the difference between event.key and event.code?

event.key is the character or logical key produced (affected by Shift and keyboard layout), while event.code is the physical key on the keyboard (layout-independent). Use code for position-based shortcuts and key for character input.

Should I use keyCode?

keyCode (and which) are deprecated but still shown here for legacy code. New code should use event.key or event.code instead.

Why does nothing happen when I press a key?

Click the press-area first so it has focus, then press a key. Modifier-only presses and some browser-reserved shortcuts may not register.

Are my key presses sent anywhere?

No. Everything is handled locally in your browser; nothing is transmitted.

Related tools

References