What is Keycode Info?
Keycode Info — A Keycode Info Tool is a free tool that displays the JavaScript keyCode, key, code, and event properties for any key you press on your keyboard.
Loading your tools...
Press any key to instantly see its JavaScript event properties — keyCode, key, code, which, location, and modifier states (Shift, Ctrl, Alt, Meta). Essential for building keyboard shortcuts and debugging keydown/keyup events.
Keycode Info: Press any key on your keyboard to instantly see its keyCode, event.key, event.code, and modifier state (Shift, Ctrl, Alt, Meta). Useful for building keyboard shortcuts and handling key events in JavaScript.
Press the key on your keyboard you want to get info about this key
Press any key to see javascript keycode, code, location and modifiers
Keycode Info — A Keycode Info Tool is a free tool that displays the JavaScript keyCode, key, code, and event properties for any key you press on your keyboard.
Focus the capture area in the tool.
Press any key or key combination.
Review key, code, keyCode, location, and modifiers.
Copy values into your event-handling logic.
Keyboard shortcut implementation
Form interaction debugging
Cross-browser input checks
Accessibility and hotkey QA
When you press a key in a browser, JavaScript fires a KeyboardEvent with multiple properties describing what happened. Each property answers a different question:
event.key — the logical character produced ("A", "a", "Enter", "ArrowUp", "$"). Reflects keyboard layout and modifier state. Shift+a = "A". Use this for character-based logic (text input, single-char shortcuts).event.code — the physical key position ("KeyA", "Enter", "ArrowUp", "Digit1"). Independent of layout — Shift+a still gives "KeyA". Use this for game controls, layout-independent shortcuts (WASD movement, Ctrl+Z based on physical Z key).event.keyCode (deprecated) — legacy numeric code (65 for A, 13 for Enter). Inconsistent across browsers. Use only for IE/legacy support; otherwise prefer key or code.event.which (deprecated) — same as keyCode, even older.event.location — distinguishes left vs right Shift/Ctrl/Alt (0=standard, 1=left, 2=right, 3=numpad).event.repeat — true when key is held down (repeated keydown events).event.shiftKey / ctrlKey / altKey / metaKey — modifier states. metaKey = Cmd on Mac, Win key on Windows.event.isComposing — true during IME (Input Method Editor) composition. Important for CJK input.| Use case | Use | Why |
|---|---|---|
| Text input fields | event.key | Reflects actual character user wants |
| "Press Enter to submit" | event.key === "Enter" | Enter is layout-independent character |
| Arrow keys for nav | event.key ("ArrowUp" etc.) | Logical navigation intent |
| WASD game controls | event.code ("KeyW") | Physical position — works on Dvorak / AZERTY too |
| Ctrl+S to save | event.code === "KeyS" | Same physical key across layouts |
| "Type & to add tag" | event.key === "&" | Reflects actual character even on different layouts |
| Numpad-specific behavior | event.code ("Numpad1") + event.location === 3 | Distinguishes numpad from regular row |
| Key | event.key | event.code | Legacy keyCode |
|---|---|---|---|
| Enter | "Enter" | "Enter" | 13 |
| Tab | "Tab" | "Tab" | 9 |
| Escape | "Escape" | "Escape" | 27 |
| Space | " " | "Space" | 32 |
| Backspace | "Backspace" | "Backspace" | 8 |
| Delete | "Delete" | "Delete" | 46 |
| Arrow Up | "ArrowUp" | "ArrowUp" | 38 |
| Arrow Down | "ArrowDown" | "ArrowDown" | 40 |
| F1-F12 | "F1"... | "F1"... | 112-123 |
| Letter A | "a" / "A" | "KeyA" | 65 |
// Single key
if (event.key === "Escape") closeModal()
// Combo: Ctrl+S (Cmd+S on Mac)
if ((event.ctrlKey || event.metaKey) && event.key === "s") {
event.preventDefault()
save()
}
// Modifier-aware: only Shift+Tab (not Ctrl+Shift+Tab)
if (event.key === "Tab" && event.shiftKey && !event.ctrlKey) {
navigateBackward()
}
// Layout-independent (game): WASD
const moves = { KeyW: "up", KeyA: "left", KeyS: "down", KeyD: "right" }
const direction = moves[event.code]
if (direction) movePlayer(direction)
// Number row vs numpad
if (event.code.startsWith("Digit")) handleTopRowNumber()
if (event.code.startsWith("Numpad")) handleNumpadNumber()event.metaKey || event.ctrlKey for "modifier+key" shortcuts that should work on both platformsevent.keyCode works pre-IE9. Modern code can ignore IE.keydown / keyup, never keypress. Prefer keydown for shortcuts.event.key = "Dead".event.isComposing to filter.keydown with key === "Unidentified". Use input event for mobile-compatible text capture.