BasicApps Logo
Keycode Info

Display keyboard keycodes and event information for key press debugging and development

Press any key on your keyboard to get its JavaScript event codes

Simply press any key (Space, Enter, letters, numbers, arrows, function keys) and see its properties instantly

Press any key on this page and you'll see three things immediately: event.key, event.code, and event.keyCode. They look similar but they answer different questions. event.key is the character produced — so Shift+a gives you "A", not "a". event.code is the physical key position — "KeyA" regardless of whether Shift is held or what keyboard layout you're on. event.keyCode is a legacy numeric value that browsers still support for backwards compatibility but that the spec has deprecated. If you're writing new code, use event.key for text input and event.code for keyboard shortcuts and game controls.

Why event.code matters for keyboard shortcuts on international keyboards

Here's the problem event.code solves: a German keyboard has Z and Y swapped compared to a US keyboard. If your game has a "W-A-S-D to move" control scheme and you use event.key, players on a QWERTZ keyboard will have Z and Y in the wrong positions. If you use event.code, the physical key that's in the S position is always "KeyS" regardless of what letter is printed on it or what layout the OS is using. For shortcuts where the letter matters to the user — like Ctrl+Z for Undo — use event.key. For positional controls — like WASD movement — use event.code. This tool shows both values side by side so you can pick the right one for your use case without guessing.