RootUtils

Keycode Info

Client-Side Secure

Free online Keycode Info. Get JavaScript event keycodes, code, and key values instantly by pressing any key. Essential tool for web developers.

Press Any Key

Focus this window and type to reveal JavaScript event codes.

Is this tool broken?

Let us know if you found a bug or have a feature request.

JavaScript KeyCode Event Info

Press any key to instantly view its event.key, event.code, event.which, and modifier states.

This tool is essential for web developers debugging keyboard shortcuts, game controls, and accessibility features. It captureskeydown events in real-time.

Key vs Code

event.key: The character generated (e.g. "a" or "A"). Use this for text input.

event.code: The physical key on the keyboard (e.g. "KeyA"). Use this for game controls (WASD) so they work on any keyboard layout (QWERTY, AZERTY, etc.).

Deprecated Values

Avoid using event.keyCode, event.which, and event.charCode. They are inconsistent across browsers and deprecated in modern web standards. Always prefer key or code.

Common Key Codes

KeyCodeDeprecated (which)
BackspaceBackspace8
TabTab9
EnterEnter13
ShiftShiftLeft16
EscapeEscape27
SpaceSpace32

FAQ

Why is event.which 0?

On some modern browsers or mobile devices (especially Android virtual keyboards),keyCode and which may report 0 or 229 for all keys. This is known as the "composition" issue. Always rely on event.key for text input.

How to detect Command vs Control?

Use the event.metaKey property to detect the Command (⌘) key on macOS, and event.ctrlKey for Control on Windows/Linux.