Keyboard Key Code Finder

Press any key to instantly see all JavaScript keyboard event properties: event.key, event.code, keyCode, which, charCode, and active modifiers. History of last 10 keys, copy any value. Free, 100% client-side.

Click here, then press any key

Common Key Reference
Key event.key event.code keyCode

Did we solve your problem today?

Keyboard Key Code Finder

Click inside the capture area and press any key to instantly see every JavaScript keyboard event property: event.key, event.code, keyCode, which, charCode, and the active modifier keys. All processing happens in your browser — no keystrokes leave your device.

event.key vs. event.code

These two properties look similar but serve different purposes:

PropertyWhat it returnsLayout-aware?
event.keyThe printed character or key name as typedYes — Shift+a gives “A”
event.codeThe physical key position on the keyboardNo — always “KeyA” for the A key

Use event.key when you care about what character the user typed. Use event.code when you care about which physical key was pressed regardless of modifiers or keyboard layout — for example, game controls that should work the same on AZERTY and QWERTY keyboards.

Deprecated Properties

Three properties shown by this tool are marked deprecated by the W3C and should not be used in new code:

Modern code should use event.key and event.code instead. These deprecated properties are shown for compatibility reference when working with older codebases.

Location Values

The location property distinguishes keys that appear more than once on the keyboard:

ValueMeaning
0Standard (most keys)
1Left side (Left Shift, Left Ctrl, Left Alt)
2Right side (Right Shift, Right Ctrl, Right Alt)
3Numpad

Common Use Cases

Detecting key combinations: Use event.code combined with event.ctrlKey, event.shiftKey, event.altKey, and event.metaKey to build keyboard shortcuts that work independently of the user’s keyboard layout.

Text input handling: Use event.key to check what character was entered. For example, event.key === 'Enter' reliably detects the Enter key regardless of platform or layout.

Game controls: Map physical positions (e.g. WASD) using event.code so the controls remain in the same place on all keyboard layouts.

FAQ

What is the difference between event.key and event.code?

event.key returns the character or key name as typed — it reflects the keyboard layout and shift state (e.g. "A" with Shift, "a" without). event.code always reflects the physical key position regardless of layout or modifiers — "KeyA" for the A key no matter what.

What is keyCode and is it still used?

keyCode is a legacy property that returns a numeric code for the pressed key. It is deprecated in modern browsers — the W3C recommends using event.key and event.code instead. However, keyCode is still widely used in older codebases, which is why this tool shows all three.

What does the location property mean?

location indicates where on the keyboard the key is physically located. 0 = standard, 1 = left side modifier (e.g. Left Shift), 2 = right side modifier (e.g. Right Alt), 3 = numpad. This lets you distinguish Left Ctrl from Right Ctrl, for example.

Is my input sent to a server?

No. This tool runs entirely in your browser using the native Web KeyboardEvent API. No keystrokes are sent anywhere — everything stays on your device.