KeyCode Finder

Press any key to instantly see all JavaScript keyboard event properties. Includes a full ASCII reference table and key history log.

Click here & press a key
Click to focus, then press any key on your keyboard

Key Properties

event.key
Character produced (Shift-aware)
event.code
Physical key location
event.keyCode
Legacy numeric code (deprecated)
event.which
jQuery legacy code
event.location
0=Standard, 1=Left, 2=Right, 3=Numpad
charCode (ASCII)
Character code if printable
CtrlAltShiftMeta ⌘

Key History

Last 10 keys pressed — click any chip to reload its details.

Press keys to build history...

ASCII Reference Table

Complete ASCII table (0–255): standard (0–127) and extended (128–255).

DecHexCharHTML EntityName / Description

How to Use This KeyCode Finder

1
Click & Focus
Click the detection area at the top of the page. This gives it keyboard focus so it can capture your key presses.
2
Press Any Key
Press the key you want to inspect. All JavaScript event properties appear instantly — key, code, keyCode, which, location, and modifiers.
3
Review Modifier States
Hold Ctrl, Alt, Shift, or Meta (Cmd) while pressing a key. The modifier badges light up to show which are active during each key press.
4
Browse ASCII Table
Scroll down to reference the full ASCII table with decimal, hex, character, and HTML entity values for all 256 codes. Use search to find specific characters.

Frequently Asked Questions

What is the difference between event.key and event.code?
event.key returns the character the key produces (e.g., 'a', 'A', 'Enter', 'ArrowLeft'), accounting for Shift state and keyboard layout. event.code returns the physical key location on a standard QWERTY keyboard (e.g., 'KeyA', 'Enter', 'ArrowLeft'), which stays the same regardless of layout. Use event.code for game controls (WASD positions), and event.key for text input processing.
Why is event.keyCode deprecated?
event.keyCode was deprecated because it returns a numeric code tied to a physical key position, not the intended character. On AZERTY keyboards, pressing the A key might return keyCode 81 (which is Q on QWERTY). Modern code should use event.key (for the character) or event.code (for the physical key location). MDN and the W3C recommend against using keyCode in new projects.
How do I detect Ctrl+C or Cmd+C combinations?
Check both the key and the modifier: if (event.key === 'c' && (event.ctrlKey || event.metaKey)) { /* copy! */ }. The event.ctrlKey property is true when Ctrl is held (Windows/Linux), and event.metaKey is true when Cmd is held (Mac). Always check both for cross-platform compatibility. Some browsers also support event.modifiers for more granular checks.
What is the ASCII code for the Enter key?
The Enter/Return key has ASCII code 13 (0x0D in hex), which is the Carriage Return (CR) control character. Other common control codes: Escape = 27, Backspace = 8, Tab = 9, Space = 32, Delete = 127. These are all visible in the ASCII reference table below in the 0-31 (control characters) and 127 (DEL) ranges.
How do I detect arrow keys and function keys?
Arrow keys and function keys don't produce printable characters. Use event.key: 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'F1' through 'F12', 'Home', 'End', 'PageUp', 'PageDown'. Or use event.code which gives the same values. For game input, event.code is preferred because it's independent of keyboard layout. The event.location property distinguishes left vs right modifier keys (1=Left, 2=Right).

What is a KeyCode?

A keycode (or key code) is a numeric identifier that represents which key on a keyboard was pressed. In JavaScript, keyboard events carry multiple properties that describe the key: event.key gives the character value (like "a" or "Enter"), event.code identifies the physical key (like "KeyA" or "Enter"), and event.keyCode — the legacy numeric representation — returns a number like 65 for the A key. Understanding these properties is essential for web developers building forms, games, keyboard shortcuts, or any interactive application that responds to keyboard input.

The concept of key codes dates back to the earliest days of computing, when terminals communicated using 7-bit ASCII character codes over serial connections. Different systems used different mappings between physical keys and character codes — IBM PCs used scan code set 1, Macintosh used a completely different mapping, and Unix terminals used yet another. JavaScript's keyCode property originally reflected these platform-specific values, which made cross-browser keyboard handling notoriously difficult until the standardization of event.key and event.code in the UI Events specification (DOM Level 3).

event.key vs event.code vs event.keyCode

PropertyTypeStatusExample (A key)Example (Enter)Best Use
event.keyString✅ Current standard"a" or "A""Enter"Text input, character detection
event.codeString✅ Current standard"KeyA""Enter"Game controls, physical key binding
event.keyCodeNumber⚠ Deprecated6513Legacy support only
event.whichNumber⚠ Deprecated6513jQuery legacy — do not use
event.charCodeNumber⚠ Deprecated97 or 650 (non-printable)Character code (keypress only)

Keyboard Event Modifier Properties

Every keyboard event includes boolean modifier flags that indicate which modifier keys were held down during the key press: