Frontend & Web API Studio
JavaScript KeyCode Inspector
Press any key on your keyboard to instantly inspect JavaScript KeyboardEvent parameters, modifiers, physical codes, and event listener snippets.
Live Keystroke Capture Active
32
Key: Space
ShiftCtrlAlt / OptionMeta / Cmd / Win
Event Properties
| event.key | "Space" |
| event.code | "Space" |
| event.keyCode (Legacy) | 32 |
| event.which (Legacy) | 32 |
| event.location | Standard (0) |
Recent Keystrokes:
Code Snippet Generator
Vanilla JavaScript
window.addEventListener('keydown', (event) => {
if (event.code === 'Space') {
console.log('Key pressed:', event.key);
}
});React useEffect Hook
useEffect(() => {
const handleKeyDown = (event) => {
if (event.code === 'Space') {
console.log('Action triggered by Space');
}
};
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, []);JavaScript KeyCode Reference Table
| Key Name | event.key | event.code | keyCode | Category |
|---|---|---|---|---|
| Backspace | "Backspace" | Backspace | 8 | Control |
| Tab | "Tab" | Tab | 9 | Control |
| Enter | "Enter" | Enter | 13 | Control |
| Shift | "Shift" | ShiftLeft | 16 | Modifier |
| Control | "Control" | ControlLeft | 17 | Modifier |
| Alt / Option | "Alt / Option" | AltLeft | 18 | Modifier |
| Pause / Break | "Pause / Break" | Pause | 19 | Control |
| Caps Lock | "Caps Lock" | CapsLock | 20 | Modifier |
| Escape | "Escape" | Escape | 27 | Control |
| Spacebar | "Spacebar" | Space | 32 | Control |
| Page Up | "Page Up" | PageUp | 33 | Navigation |
| Page Down | "Page Down" | PageDown | 34 | Navigation |
| End | "End" | End | 35 | Navigation |
| Home | "Home" | Home | 36 | Navigation |
| Arrow Left | "Arrow Left" | ArrowLeft | 37 | Arrow |
| Arrow Up | "Arrow Up" | ArrowUp | 38 | Arrow |
| Arrow Right | "Arrow Right" | ArrowRight | 39 | Arrow |
| Arrow Down | "Arrow Down" | ArrowDown | 40 | Arrow |
| Insert | "Insert" | Insert | 45 | Control |
| Delete | "Delete" | Delete | 46 | Control |
| 0 | "0" | Digit0 | 48 | Number |
| 1 | "1" | Digit1 | 49 | Number |
| 2 | "2" | Digit2 | 50 | Number |
| 3 | "3" | Digit3 | 51 | Number |
| 4 | "4" | Digit4 | 52 | Number |
| 5 | "5" | Digit5 | 53 | Number |
| 6 | "6" | Digit6 | 54 | Number |
| 7 | "7" | Digit7 | 55 | Number |
| 8 | "8" | Digit8 | 56 | Number |
| 9 | "9" | Digit9 | 57 | Number |
| A | "A" | KeyA | 65 | Letter |
| B | "B" | KeyB | 66 | Letter |
| C | "C" | KeyC | 67 | Letter |
| D | "D" | KeyD | 68 | Letter |
| E | "E" | KeyE | 69 | Letter |
| F | "F" | KeyF | 70 | Letter |
| G | "G" | KeyG | 71 | Letter |
| H | "H" | KeyH | 72 | Letter |
| I | "I" | KeyI | 73 | Letter |
| J | "J" | KeyJ | 74 | Letter |
| K | "K" | KeyK | 75 | Letter |
| L | "L" | KeyL | 76 | Letter |
| M | "M" | KeyM | 77 | Letter |
| N | "N" | KeyN | 78 | Letter |
| O | "O" | KeyO | 79 | Letter |
| P | "P" | KeyP | 80 | Letter |
| Q | "Q" | KeyQ | 81 | Letter |
| R | "R" | KeyR | 82 | Letter |
| S | "S" | KeyS | 83 | Letter |
| T | "T" | KeyT | 84 | Letter |
| U | "U" | KeyU | 85 | Letter |
| V | "V" | KeyV | 86 | Letter |
| W | "W" | KeyW | 87 | Letter |
| X | "X" | KeyX | 88 | Letter |
| Y | "Y" | KeyY | 89 | Letter |
| Z | "Z" | KeyZ | 90 | Letter |
| F1 | "F1" | F1 | 112 | Function |
| F2 | "F2" | F2 | 113 | Function |
| F3 | "F3" | F3 | 114 | Function |
| F4 | "F4" | F4 | 115 | Function |
| F5 | "F5" | F5 | 116 | Function |
| F6 | "F6" | F6 | 117 | Function |
| F7 | "F7" | F7 | 118 | Function |
| F8 | "F8" | F8 | 119 | Function |
| F9 | "F9" | F9 | 120 | Function |
| F10 | "F10" | F10 | 121 | Function |
| F11 | "F11" | F11 | 122 | Function |
| F12 | "F12" | F12 | 123 | Function |
About this tool
Comprehensive documentation & audit utility guideJavaScript KeyboardEvent objects contain comprehensive metadata about user input, including the modern standard event.key, physical layout identifier event.code, and legacy numeric keyCode / which values. This inspector captures keystrokes in real-time and generates listener boilerplate.
How it works
1
Press Any Key
Hit any physical key, modifier combo, or function key on your keyboard.
2
Inspect Event Object
View event.key, event.code, numeric keyCode, location index, and modifier booleans.
3
Copy Snippet
Grab boilerplate event listener code for Vanilla JS or React useEffect hooks in one click.
Key Features & Capabilities
Real-time event capture for event.key, event.code, keyCode, which, and charCode
Live modifier key detection (Shift, Ctrl, Alt/Option, Meta/Command/Windows)
Key location detection (Standard 0, Left 1, Right 2, Numpad 3)
Searchable database covering standard alphanumeric, function (F1-F12), navigation, and control keys
