Skip to main content
ToolsHub

JavaScript Keycode Info

Press a key and instantly read its event.key, event.code, keyCode and modifier flags — a live keyboard event inspector in your browser.

Updated

Files never leave your browser
Click here, then press any keyKey events are captured live in your browser — nothing is sent anywhere.
Common keys reference
keycodekeyCode
EnterEnter13
EscapeEscape27
SpaceSpace32
TabTab9
BackspaceBackspace8
DeleteDelete46
ArrowUpArrowUp38
ArrowDownArrowDown40
ArrowLeftArrowLeft37
ArrowRightArrowRight39
aKeyA65
0Digit048
F1F1112

event.keyCode is deprecated — prefer event.code for physical keys and event.key for the produced character.

How to use JavaScript Keycode Info

The JavaScript Keycode Info tool is a live keyboard-event inspector. Focus the capture area, press any key, and it shows you the exact values your browser reports — event.key, event.code, the legacy event.keyCode, the physical key location and which modifier keys were held. It is the quickest way to find the right identifier when you are wiring up a keyboard shortcut, debugging a hotkey handler, or just curious what a particular key produces. A built-in reference table also lists the values for the most common keys, and everything runs locally so your keystrokes are never recorded or sent anywhere.

  1. Click the capture area so it has keyboard focus.
  2. Press the key or key combination you want to inspect.
  3. Read the reported event.key, event.code, keyCode and modifiers.
  4. Copy the details if you need them for your code.
  5. Use the reference table below for common keys without pressing them.

Your data never leaves your device — 100% private processing.

key vs code vs keyCode

Modern keyboard events expose three identifiers that are easy to confuse. event.key is the character or named value the key produces in the current layout and modifier state — pressing Shift+a gives "A", and a layout-aware key like AltGr can change it. event.code is the physical key on the keyboard, written as a stable name like "KeyA" or "Digit1" that does not change with layout, which makes it ideal for game controls and position-based shortcuts. event.keyCode is the old numeric code (65 for the A key) that predates both; it is deprecated, varies between browsers, and should be avoided in new code. Choosing the right one — code for physical position, key for the typed character — prevents most shortcut bugs.

Identifier comparison for the “A” key
PropertyValueUse it for
event.keya (or A with Shift)The character actually typed
event.codeKeyAThe physical key, layout-independent
event.keyCode65 (deprecated)Legacy code only — avoid in new code

Modifier keys and key location

Each keyboard event also carries four boolean modifier flags — ctrlKey, altKey, shiftKey and metaKey (Command on macOS, Windows key on Windows) — which this tool summarises so you can see exactly which combination was pressed. The location value distinguishes otherwise-identical keys: a left Shift reports location “Left”, a right Shift reports “Right”, and number-pad keys report “Numpad”, which lets you treat the numeric keypad differently from the top-row digits. Knowing both the modifiers and the location is essential when you want a shortcut like Ctrl+Left-Shift to behave differently from Ctrl+Right-Shift, or when a Numpad Enter should do something distinct from the main Enter key.

Worked examples

Press Enter

Inputs: Enter key

Result: key: Enter · code: Enter · keyCode: 13

Press Shift+A

Inputs: Shift + a

Result: key: A · code: KeyA · modifiers: Shift

Glossary

event.key
The DOM property holding the character or named value a key produces, accounting for layout and modifiers.
event.code
The DOM property naming the physical key pressed, independent of keyboard layout.
keyCode
A deprecated numeric key identifier kept only for backward compatibility with older code.
Modifier key
A key such as Ctrl, Alt, Shift or Meta that changes the meaning of another key when held.
Key location
A value indicating where a key sits — standard, left, right or numpad — used to tell duplicate keys apart.

Related reading

Frequently Asked Questions

Free · No spam

Get weekly tool tips & updates

New tools, power-user tips, and productivity hacks — delivered free every Friday.

No spam, ever. Unsubscribe with one click.

Why use JavaScript Keycode Info?

  • See event.key, event.code and keyCode for any key in real time
  • Identify modifier combinations (Ctrl, Alt, Shift, Meta) at a glance
  • Distinguish physical keys from produced characters across layouts
  • Includes a quick-reference table of common keys and codes
  • Captures keys locally — keystrokes are never logged or uploaded

Common use cases

  • Find the correct event.code when building a keyboard shortcut
  • Debug why a hotkey handler is not firing for a specific key
  • Compare key values between different keyboard layouts
  • Teach how the DOM keyboard event model works
  • Look up the deprecated keyCode for legacy code you are maintaining

Related Developer Tools

Explore all Developer Tools.