1001Ferramentas
⌨️ Dev

Keycode Info

Press any key and see `event.key`, `event.code`, `keyCode`, `which` and `location`. Useful to build shortcuts, games and keyboard-aware forms. Everything in your browser.

Press any key while this panel has focus.

event.key
event.code
event.keyCode (legacy)
event.which (legacy)
event.location
Modifiers

Find any key's code

Anyone programming keyboard interactions in JavaScript needs to know exactly which values each key fires. The tool shows that right on screen: click the panel field to give it focus and press a key — the event's fields all appear together: event.key, event.code, keyCode, which and location.

For building shortcuts, games that react to the keyboard, forms with custom navigation or any feature that captures keys, this is fundamental. Rather than checking outdated tables (keyCode, for instance, is already deprecated), you see the real values the browser delivers for that specific key.

It runs entirely in the browser, with nothing to install. It works as a living reference for front-end developers to debug keyboard events precisely.

Frequently asked questions

I pressed a key and nothing changed on screen
The panel listens to the text field at the top only, and only to the keydown event. The page drops the cursor there on load, but if you clicked elsewhere, scrolled or switched tabs, focus moved away and keys stop being recorded: click the field again. Combinations the operating system grabs before the browser, such as Alt+Tab, Cmd+Q or Cmd+Space, never reach the page and will never show up. Nothing gets typed into the field because the key's default behaviour is cancelled.
Why is event.key shown in quotes when the other fields are not?
That value is printed serialised, which makes visible what a bare string would hide. The space bar shows up as a pair of quotes with a space between them, instead of looking like an empty field; Enter reads as the word Enter in quotes; and a dead accent key reads as Dead. The code, keyCode, which and location fields are printed raw, without quotes, because they carry no such ambiguity.
keyCode and which show the same number. Which one should I use?
Neither, in new code. Both are legacy, and the browser fills them with the same value purely for backward compatibility. Reach for event.key when the produced character matters, since it shifts with Shift and with the layout, and for event.code when physical position matters: the key next to Tab is KeyQ on QWERTY and stays KeyQ on an AZERTY board, where key returns the letter a. The location field settles the other classic question, telling left Shift from right Shift and flagging the numeric keypad, with the values STANDARD, LEFT, RIGHT and NUMPAD.

Related Tools