Keycode Info
Press any key to see its event.key, event.code, deprecated keyCode, location and modifier states — plus a reference table of common keys.
Common keys — static reference
How a standard US layout reports the most-used keys. On other layouts event.key changes with the character produced; event.code keeps naming the same physical key.
| event.key | event.code | keyCode | location |
|---|---|---|---|
| a | KeyA | 65 | Standard |
| b | KeyB | 66 | Standard |
| c | KeyC | 67 | Standard |
| d | KeyD | 68 | Standard |
| e | KeyE | 69 | Standard |
| f | KeyF | 70 | Standard |
| g | KeyG | 71 | Standard |
| h | KeyH | 72 | Standard |
| i | KeyI | 73 | Standard |
| j | KeyJ | 74 | Standard |
| k | KeyK | 75 | Standard |
| l | KeyL | 76 | Standard |
| m | KeyM | 77 | Standard |
| n | KeyN | 78 | Standard |
| o | KeyO | 79 | Standard |
| p | KeyP | 80 | Standard |
| q | KeyQ | 81 | Standard |
| r | KeyR | 82 | Standard |
| s | KeyS | 83 | Standard |
| t | KeyT | 84 | Standard |
| u | KeyU | 85 | Standard |
| v | KeyV | 86 | Standard |
| w | KeyW | 87 | Standard |
| x | KeyX | 88 | Standard |
| y | KeyY | 89 | Standard |
| z | KeyZ | 90 | Standard |
| 0 | Digit0 | 48 | Standard |
| 1 | Digit1 | 49 | Standard |
| 2 | Digit2 | 50 | Standard |
| 3 | Digit3 | 51 | Standard |
| 4 | Digit4 | 52 | Standard |
| 5 | Digit5 | 53 | Standard |
| 6 | Digit6 | 54 | Standard |
| 7 | Digit7 | 55 | Standard |
| 8 | Digit8 | 56 | Standard |
| 9 | Digit9 | 57 | Standard |
| Enter | Enter | 13 | Standard |
| Escape | Escape | 27 | Standard |
| Backspace | Backspace | 8 | Standard |
| Tab | Tab | 9 | Standard |
| Space | Space | 32 | Standard |
| ArrowUp | ArrowUp | 38 | Standard |
| ArrowDown | ArrowDown | 40 | Standard |
| ArrowLeft | ArrowLeft | 37 | Standard |
| ArrowRight | ArrowRight | 39 | Standard |
| Shift | ShiftLeft | 16 | Left / Right |
| Control | ControlLeft | 17 | Left / Right |
| Alt | AltLeft | 18 | Left / Right |
| Meta | MetaLeft | 91 | Left / Right |
| CapsLock | CapsLock | 20 | Standard |
| F1 | F1 | 112 | Standard |
| F2 | F2 | 113 | Standard |
| F5 | F5 | 116 | Standard |
| F12 | F12 | 123 | Standard |
| Delete | Delete | 46 | Standard |
| Insert | Insert | 45 | Standard |
| Home | Home | 36 | Standard |
| End | End | 35 | Standard |
| PageUp | PageUp | 33 | Standard |
| PageDown | PageDown | 34 | Standard |
| 0 | Numpad0 | 96 | Numpad |
| 1 | Numpad1 | 97 | Numpad |
| 9 | Numpad9 | 105 | Numpad |
| + | NumpadAdd | 107 | Numpad |
| - | NumpadSubtract | 109 | Numpad |
| * | NumpadMultiply | 106 | Numpad |
| / | NumpadDivide | 111 | Numpad |
| Enter | NumpadEnter | 13 | Numpad |
| . | Period | 190 | Standard |
| , | Comma | 188 | Standard |
| ; | Semicolon | 186 | Standard |
| ' | Quote | 222 | Standard |
| [ | BracketLeft | 219 | Standard |
| ] | BracketRight | 221 | Standard |
| \ | Backslash | 220 | Standard |
| ` | Backquote | 192 | Standard |
| - | Minus | 189 | Standard |
| = | Equal | 187 | Standard |
| / | Slash | 191 | Standard |
Examples
Inspect Ctrl+C
keydown while holding Ctrlkey "c" · code "KeyC" · keyCode 67 · location 0 · modifiers [Ctrl]The modifier booleans ride on the same event, so shortcut debugging needs a single press, not three.
Tell the two Shift keys apart
left Shift, then right Shiftkey "Shift" · code "ShiftLeft"/"ShiftRight" · location 1/2Both report key "Shift"; only code and location distinguish the physical sides — the reason games use code.
Look up a legacy keyCode
press EscapekeyCode 27 — labeled deprecated, next to key "Escape" and code "Escape"Exactly the number an old switch statement expects, with its modern replacements alongside.
About this tool
When JavaScript receives a keyboard event, three different properties describe what happened, and they answer three different questions. event.key says what character the user intended to type — "a", "?", "Enter" — and it changes with the active keyboard layout: on a French AZERTY layout the physical QWERTY A key reports key "q". event.code names the physical key itself — "KeyA", "Backquote", "Numpad1" — and stays constant across layouts, which makes it the right choice for game controls and shortcuts that must sit in the same place on every keyboard. keyCode is the deprecated numeric code from the pre-standard era (65 for A, 13 for Enter) that legacy code still depends on. The Keycode Info tool shows all three side by side for every key you press, plus KeyboardEvent.location (standard, left, right, numpad) and the full modifier state.
Using the tool is deliberately friction-free: click the capture area once so it has focus, then press any key or shortcut. The latest event renders live — key, code, keyCode, location, modifiers — and a rolling history keeps the last 20 presses so you can compare a sequence like Ctrl+C or Shift+Tab against the events you actually received. A one-click Copy JSON button serializes the current event with exactly the field names you would destructure in code: key, code, keyCode, location, altKey, ctrlKey, metaKey, shiftKey. The capture never blocks anything — the listener observes keydown without preventing default, so browser shortcuts keep working while you inspect them.
The static reference table below the tool covers the keys developers look up most often: the 26 letters and 10 digits with their KeyA/Digit0 codes and ASCII-derived keyCodes, control keys (Enter, Escape, Backspace, Tab, Space), navigation keys (arrows, Home, End, PageUp, PageDown), function keys, the left/right modifier distinction, and the numpad block whose Digit keys deliberately duplicate the digit keys' key values while carrying distinct codes and location 3. On non-US layouts the table's key column still holds the US expectation — the mismatch you observe is the layout-dependence the tool exists to demonstrate, and pairing the code column with it is exactly how you normalize input across layouts.
One property needs honest labeling: keyCode is deprecated in the DOM standard, and modern guides rightly push you toward key and code. It is shown anyway, clearly marked as deprecated, because an enormous amount of shipped JavaScript still switches on those numbers and every browser still populates the field. The practical pairing this tool encourages: prefer event.key for character-sensitive logic (search boxes, typing games), prefer event.code for physical-position logic (WASD movement, game controls), and reach for keyCode only when maintaining legacy code that already uses it. Everything runs entirely in your browser — keydown events never leave the device, there are no network calls, and nothing you press is stored beyond this page's session.
What this tool does not do
- Reports keydown only — character-producing keypress/input events and IME composition flows are out of scope.
- The static reference table reflects a standard US layout; your layout's key values will differ by design.
- Detection requires page focus: keys pressed while another window or iframe holds focus never reach the listener.
How to use this tool
Click the capture area
Give the dashed capture zone focus — one click is enough. The tool listens only while this page has focus and never swallows shortcuts.
Press any key or shortcut
The latest keydown renders live: event.key, event.code, keyCode, location and the active modifier set. Space shows as " " (Space) instead of vanishing.
Compare the history
The last 20 presses stay listed newest-first — handy for spotting which physical key each modifier side reports and for sequences like Ctrl+Shift+P.
Copy JSON or consult the table
Copy the current event as JSON in code-ready field names, or look up a key in the static reference table of common US-layout values.
Use cases
Building keyboard shortcuts
Check what your shortcut actually fires as before wiring the handler — including which side of Shift or Alt was held.
Game and canvas controls
Confirm the event.code values for WASD and arrows so controls stay put on AZERTY, QWERTZ and Cyrillic layouts.
Maintaining legacy input code
Map the deprecated keyCode numbers an old codebase switches on to their modern key/code equivalents during refactors.
What each keyboard-event property tells you
| Property | What it reports |
|---|---|
| event.key | The produced character or named key — layout-dependent ("a", "?", "Shift", "Enter") |
| event.code | The physical key — layout-independent ("KeyA", "Backquote", "Numpad1") |
| event.keyCode (deprecated) | Legacy numeric code still shipped by all browsers (65 for A, 13 for Enter) |
| event.location | 0 standard, 1 left, 2 right, 3 numpad |
| altKey / ctrlKey / metaKey / shiftKey | Modifier booleans on the same event object |
Layout drift example: on AZERTY, pressing the key labeled A reports event.key "q" but event.code "KeyA" — the physical position is stable, the character is not.
Common mistakes
Mistake:Matching input on event.key and breaking non-US users.
Fix:event.key follows the active layout, so WASD controls drift on AZERTY or QWERTZ. Match on event.code when physical position matters; keep key for character-sensitive logic.
Mistake:Reaching for keyCode in new code.
Fix:keyCode is deprecated — every browser still ships it, but new handlers should read key and code. Use this tool's labeled keyCode column only when maintaining legacy switch statements.
Mistake:Assuming both Shift keys are identical events.
Fix:Both report key "Shift", but their codes (ShiftLeft/ShiftRight) and locations (1/2) differ. Capture both in the history to see the split before writing side-specific logic.
Frequently asked questions
What is the difference between event.key and event.code?
event.key reports the character the active keyboard layout produces — "a", "?", "Enter" — so it changes when the user switches layouts. event.code names the physical key by its position on a standard US layout — "KeyA", "Backquote" — and never changes. Match input on event.key when the character matters (search fields, typing detection) and on event.code when the physical position matters (WASD movement, game controls, position-stable shortcuts). Pressing the same key on AZERTY demonstrates the split: the key value drifts while the code stays "KeyA".
Why is keyCode shown if it is deprecated?
keyCode was never part of the formal DOM standard, and modern documentation recommends event.key and event.code instead — but every browser still populates it, and a huge amount of shipped JavaScript still switches on its numbers (65 for A, 13 for Enter). The tool displays it clearly labeled as deprecated so you can maintain legacy handlers without guessing. For new code, treat the keyCode column as a lookup aid, not a recommendation.
How do I tell the left and right Shift, Ctrl or Alt keys apart?
KeyboardEvent.location distinguishes the sides: 1 means left, 2 means right, 3 means the numpad, and 0 means the key has no location distinction. The event.code carries the same information with names like ShiftLeft, ShiftRight or ControlLeft. Both Shift keys report the same event.key ("Shift"), so location or code is the only reliable discriminator. Press each side in the capture area and watch the location row flip between 1 and 2.
Does pressing keys here send my keystrokes anywhere?
No. The tool attaches a local keydown listener in your browser; the event object is read in JavaScript and rendered on the page, and nothing — not the key, the code, or the history — is uploaded to any server. There are no network calls at any point, and the capture history lives only in page memory, so it disappears when you leave. You can safely press real shortcuts, including ones involving browser combos; the listener observes without preventing default.
Why does Space sometimes show as an empty value?
Space's event.key is a single space character, which is invisible in a table cell. The tool renders it as " " (Space) so it stays visible, and its event.code is the unambiguous "Space" with keyCode 32. The same readability rule applies in the history list — bare space is shown as Space there too. If you are matching input in code, comparing against " " directly works, but many codebases prefer event.code === "Space" for readability.
Which property should a game use for movement keys?
Use event.code. A player on a French or German layout still has W, A, S, D in the same physical positions, and event.code keeps those positions stable ("KeyW", "KeyA", "KeyS", "KeyD") no matter what character the layout emits. Pair it with KeyboardEvent.location when you need to distinguish duplicate keys such as the two Shifts or the numpad digits from the number row. Character-dependent mechanics — typing tutors, chat-in-game — are the ones that should read event.key instead.
References & standards
Related tools
Device Information
See what your browser reveals about your device — screen, hardware hints, platform and capabilities.
User Agent Parser
Parse User-Agent strings to identify browser, OS and device.
Unicode Character Inspector
Inspect Unicode characters with detailed information: code points, escape sequences, HTML entities, CSS codes, and character properties.