Keycode Finder

Press a key to see event.key, event.code, keyCode and modifiers.

About this tool

Click the box and press any key or shortcut. The tool shows event.key, event.code, the legacy keyCode and which numbers, the key's location, such as left or right Shift or the numpad, and any modifiers held down. Each value has a copy button, the last 12 presses are listed, and a keydown listener snippet is written for the combination you pressed. A reference table lists common keys.

Which keyboard event property to use

Keyboard events carry several properties, and choosing the right one avoids layout bugs. event.key is the value the key produces: "a" or "A" depending on Shift, "Enter", "ArrowLeft", or "โ‚ฌ" on keyboards that type it. Use it for text input and for shortcuts that are tied to a letter, because it respects the user's keyboard layout. event.code is the physical key position, written in US-QWERTY terms: "KeyA" is the key to the right of Caps Lock whether the layout is QWERTY, AZERTY or Dvorak. Use it for game controls such as WASD, where position matters more than the letter. keyCode and which are older numeric codes, such as 13 for Enter and 37 for the left arrow. They're deprecated, inconsistent for punctuation across browsers and layouts, and best avoided in new code, though you'll still meet them in older libraries. event.location separates left and right modifier keys and the numpad from the main number row. Honest limits: the operating system and browser keep some shortcuts, such as switching tabs or closing windows, so they never reach the page. Input method editors for languages such as Chinese and Japanese, and dead keys used for accents, report special values such as "Process" or "Dead". The keyboard tester checks every key on a keyboard and the spacebar counter is a quick speed game.

Frequently asked questions

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

event.key is the character or action produced; event.code is the physical key position, independent of layout.

Is keyCode deprecated?

Yes. It still works in browsers but is inconsistent; use event.key or event.code in new code.

What is the keyCode for Enter?

13. Its event.key is "Enter" and its event.code is "Enter" (or "NumpadEnter" on the numpad).

Is my data saved?

No. Key presses are shown only in your browser and nothing is stored or sent.