loot.tools

Key Code Finder

Press a key and instantly see every value a JavaScript keydown event reports for it: event.key, event.code, the deprecated keyCode and which numbers, the key location, and which modifier keys (Ctrl, Shift, Alt, Meta) were held. Handy when you're wiring up keyboard shortcuts, game controls, or form handlers and need the exact identifier to match against. Everything runs in your browser - the key events never leave the page.
Press any keyClick here first if nothing shows up, then press a key.

event.key is the character the key produces, so it shifts with the keyboard layout and modifiers ("a" vs "A"). event.code is the physical key position and never changes ("KeyA" wherever that key sits on the board) - it's what you want for game controls and shortcuts. keyCode and which are the old numeric properties, deprecated but still handy when you're matching legacy code. Nothing is sent anywhere - the key events stay in your browser.

key vs code vs keyCode

event.key is the character produced, so it changes with the layout and modifiers - the same physical key gives 'a' or 'A'. event.code is the physical position and stays constant ('KeyA') no matter the layout, which is what you want for game movement keys (WASD) and shortcuts. keyCode and which are the old numeric values - deprecated in modern browsers but still everywhere in legacy code.

Reading the modifiers and location

The Ctrl, Shift, Alt, and Meta pills light up to show which modifiers were down when you pressed the key, matching event.ctrlKey and friends. Location tells the left vs right variant of a key (the two Shifts) and flags numpad keys, which is how you tell Numpad Enter from the main Enter.

Matching keys in your own code

Prefer event.key for text input and event.code for physical-position shortcuts - both are well supported and won't surprise you the way keyCode does across browsers and layouts. Reach for keyCode only when you have to interoperate with old code that already compares against the numbers.

Runs entirely in your browser

The tool just listens for keydown on the focused box and shows what the event carries. No keystrokes are logged, stored, or sent anywhere.