Keyboard Event Tester — Free Online Tool

Test keyboard keys, detect key codes, scan codes, modifiers. Diagnose stuck keys, ghosting, n-key rollover. Works for mechanical, laptop, wireless keyboards.

Use this free online Keyboard Event Tester directly in your browser. No signup required, no data leaves your device. Part of Utilier — a collection of 133+ developer utilities.

What is Keyboard Tester & Key Code Detector?

Keyboard tester detects and displays key presses in real-time — shows which keys you pressed, key codes (KeyCode, which), scan codes, modifiers (Shift, Ctrl, Alt), and character codes. Press any key to see its details: key name (A, Enter, Escape), JavaScript event code, ASCII/Unicode value, and whether modifiers are active. Useful for testing keyboard functionality (stuck keys, ghosting, n-key rollover), learning key codes for programming, or diagnosing hardware issues (broken keys, wireless connection).

  • Real-time key detection: Press any key (letter, number, F-keys, arrow keys, modifiers) to see instant visual feedback. Shows key name, code, and modifier state.
  • Key code information: Displays KeyCode (deprecated but widely used), which (legacy), key (modern KeyboardEvent.key), code (physical key), charCode (character code), ASCII/Unicode value.
  • Modifier detection: Shows when Shift, Ctrl, Alt, Meta (Cmd/Win) are pressed. Useful for testing keyboard shortcuts (Ctrl+C, Alt+Tab, Cmd+S).
  • Ghosting and rollover: Test n-key rollover (how many keys can be pressed simultaneously). Detect key ghosting (unwanted key presses when holding multiple keys).
  • Hardware diagnosis: Identify stuck keys (key always registers as pressed), broken keys (no response), or wireless connection issues (missed keystrokes).

Why use keyboard tester?

Testing keyboard functionality requires detecting key presses and identifying issues. This tool provides instant visual feedback for every key.

  • Test all keys: Verify every key works: letters, numbers, F-keys, arrow keys, numpad, modifiers (Shift, Ctrl, Alt), special keys (Esc, Tab, Backspace). Spot non-responsive keys instantly.
  • Learn key codes for programming: See KeyCode, which, key, code for JavaScript event handling. Essential for building keyboard shortcuts (Ctrl+S, Esc to close modal) or games (WASD movement).
  • Diagnose stuck or broken keys: Stuck key = registers as always pressed (e.g., 'a' keeps typing). Broken key = no response. Tool highlights stuck keys in red, broken keys by absence.
  • Test n-key rollover: Gaming keyboards support n-key rollover (6-key, 10-key, or full). Test how many keys register simultaneously. Critical for gaming (WASD + Shift + Space).
  • Detect key ghosting: Ghosting = unintended key registers when holding multiple keys (hardware limitation). Test with game key combos (W + A + Space) to detect ghosting.
  • Wireless keyboard testing: Test Bluetooth/wireless keyboards for missed keystrokes, lag, or connection issues. Press keys rapidly to check responsiveness.

When to use keyboard tester

Use whenever you need to test keyboard functionality or learn key codes.

  • Testing new keyboard (mechanical, laptop, wireless) to verify all keys work.
  • Diagnosing stuck keys (key always pressed) or broken keys (no response).
  • Learning key codes for JavaScript keyboard event handling (keydown, keyup, keypress).
  • Testing n-key rollover on gaming keyboards (how many keys register simultaneously).
  • Detecting key ghosting (unwanted key presses when holding multiple keys).
  • Troubleshooting wireless or Bluetooth keyboard connectivity (missed keystrokes, lag).
  • Verifying keyboard shortcuts work correctly (Ctrl+C, Alt+Tab, Cmd+S).

How to use keyboard tester

Press keys to see real-time detection and key codes.

  1. Press any key: Click in the tool area and press any key (letter, number, F-key, arrow, modifier). Key lights up on virtual keyboard or shows in list.
  2. View key information: See key name (A, Enter, Escape), KeyCode (65, 13, 27), key (KeyboardEvent.key), code (physical key), modifiers (Shift, Ctrl, Alt, Meta).
  3. Test modifiers: Hold Shift, Ctrl, Alt, or Meta (Cmd/Win) and press other keys. Tool shows modifier state (e.g., Shift+A = 'A' key with Shift active).
  4. Test all keys: Go through entire keyboard: letters, numbers, F-keys (F1-F12), arrow keys, numpad, special keys (Esc, Tab, Enter, Backspace, Delete). Mark tested keys.
  5. Check for stuck keys: If a key is highlighted red or constantly registers, it's stuck. Clean keyboard or replace key. Stuck Ctrl/Alt can cause weird behavior (all keys act like shortcuts).
  6. Test n-key rollover: Hold multiple keys simultaneously (e.g., W + A + Space + Shift). Count how many register. 6-key rollover = 6 keys max, full n-key = all keys.
  7. Diagnose ghosting: Press specific key combinations (W + A + Q, or numpad 7 + 8 + 4). If unintended keys register (e.g., pressing 7 + 8 also triggers 9), that's ghosting.

Key features

  • Real-time key detection: Instant visual feedback when keys are pressed. Virtual keyboard highlights pressed keys or displays in list.
  • Key code display: Shows KeyCode, which, key, code, charCode, ASCII/Unicode. Useful for JavaScript event handling.
  • Modifier detection: Detects Shift, Ctrl, Alt, Meta (Cmd/Win). Shows modifier state for each key press.
  • Stuck key detection: Highlights stuck keys (always pressed) in red. Helps diagnose hardware issues.
  • N-key rollover test: Test how many keys can be pressed simultaneously. Critical for gaming keyboards.
  • Ghosting detection: Identify unwanted key presses when holding multiple keys (hardware limitation).
  • All key types: Supports letters, numbers, F-keys, arrow keys, numpad, special keys (Esc, Tab, Enter, Backspace, Delete).

Common use cases

  • Test new keyboard: Verify all keys work on new mechanical, laptop, or wireless keyboard. Press every key to ensure responsiveness.
  • Diagnose stuck keys: Stuck key = constantly registers as pressed. Tool highlights in red. Causes: dirt, spilled liquid, faulty switch. Fix: clean or replace key.
  • Learn JavaScript key codes: See KeyCode (65 for 'A'), key ('a'), code ('KeyA') for event.keyCode, event.key, event.code. Essential for keyboard event handling.
  • Test gaming keyboard: Test n-key rollover (6-key, 10-key, full). Hold W + A + Space + Shift + Ctrl to verify all register. Critical for FPS or MOBA games.
  • Detect ghosting: Press game key combos (W + A + Q, numpad 7 + 8 + 4). If unintended keys register, that's ghosting (hardware limitation).
  • Wireless keyboard troubleshooting: Test Bluetooth keyboard for missed keystrokes or lag. Press keys rapidly (type sentence) to check connection stability.

Examples

Key detection examples.

Letter key (A)

Press 'A' key
key: 'a', code: 'KeyA', keyCode: 65, which: 65, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false

Lowercase 'a' (no Shift). KeyCode 65 (same for A and a). Code 'KeyA' = physical A key location.

Letter key with Shift (A)

Press Shift+A
key: 'A', code: 'KeyA', keyCode: 65, which: 65, shiftKey: true, ctrlKey: false, altKey: false, metaKey: false

Uppercase 'A' (Shift active). KeyCode still 65. shiftKey: true indicates Shift is pressed.

Special key (Enter)

Press Enter
key: 'Enter', code: 'Enter', keyCode: 13, which: 13, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false

Enter key. KeyCode 13 (standard). key: 'Enter', code: 'Enter'. No character output (not printable).

Arrow key (Up)

Press Up Arrow
key: 'ArrowUp', code: 'ArrowUp', keyCode: 38, which: 38, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false

Arrow keys: ArrowUp (38), ArrowDown (40), ArrowLeft (37), ArrowRight (39). Modern: use key ('ArrowUp') instead of keyCode.

Keyboard shortcut (Ctrl+C)

Press Ctrl+C
key: 'c', code: 'KeyC', keyCode: 67, which: 67, shiftKey: false, ctrlKey: true, altKey: false, metaKey: false

Ctrl+C (copy shortcut). ctrlKey: true indicates Ctrl is pressed. KeyCode 67 = 'C'. Detect shortcuts by checking modifiers + key.

Technical reference

Keyboard event properties and key codes:

KeyCode (deprecated)
Legacy numeric code for keys. Example: 65 = 'A', 13 = Enter, 27 = Escape, 32 = Space. Deprecated (use key or code instead) but still widely used. Case-insensitive (A and a = 65).
key (modern)
String representation of key. Example: 'a', 'A' (with Shift), 'Enter', 'Escape', 'ArrowUp'. Case-sensitive (a ≠ A). Recommended for modern apps. KeyboardEvent.key.
code (physical key)
Physical key location, keyboard-layout independent. Example: 'KeyA' (A key), 'Enter', 'Escape', 'ArrowUp'. Same for QWERTY and AZERTY layouts. KeyboardEvent.code.
which (legacy)
Alias for keyCode. Example: 65 = 'A'. Deprecated. Use key or code instead. Supported for compatibility but not recommended.
charCode (deprecated)
Unicode value of character (keypress event only). Example: 97 = 'a', 65 = 'A'. Deprecated. Use key instead. Only works with keypress, not keydown/keyup.
Modifiers (shiftKey, ctrlKey, altKey, metaKey)
Boolean flags for modifier keys. shiftKey (Shift), ctrlKey (Ctrl), altKey (Alt), metaKey (Cmd on Mac, Win on Windows). event.shiftKey = true if Shift is pressed.
N-key rollover
Number of keys that can be pressed simultaneously and register correctly. 2-key rollover (basic), 6-key (standard), 10-key (gaming), full n-key (high-end gaming). Tested by holding multiple keys.
Ghosting
Unwanted key registration when holding multiple keys (hardware limitation due to key matrix design). Example: pressing 7 + 8 on numpad also registers 9. Common on cheap keyboards.
Stuck key
Key registers as always pressed (hardware fault: dirt, liquid, faulty switch). Causes weird behavior (e.g., stuck Ctrl makes all keys act like shortcuts). Fix: clean or replace key.
Event types
keydown (key pressed), keyup (key released), keypress (deprecated, use keydown). keydown fires first, keyup fires on release. keypress only for printable keys (a-z, 0-9), not modifiers.

Common mistakes to avoid

Using keyCode instead of key or code in modern JavaScript

Why it happens: keyCode is deprecated (removed from web standards). Browsers still support it for compatibility, but it may be removed in the future. keyCode has issues: same code for different keys (a/A both 65), doesn't handle international keyboards well (AZERTY, QWERTZ).

How to avoid it: Use event.key (for character) or event.code (for physical key). Example: if (event.key === 'a') or if (event.code === 'KeyA'). More reliable and future-proof.

Not checking modifier keys, missing Ctrl+C, Shift+A distinctions

Why it happens: Example: listening for 'A' key without checking shiftKey treats 'a' and 'A' the same. Or listening for 'C' without ctrlKey = can't detect Ctrl+C shortcut. Common when implementing keyboard shortcuts.

How to avoid it: Check modifiers: if (event.key === 'c' && event.ctrlKey) for Ctrl+C. Or if (event.key === 'A' && event.shiftKey) for uppercase A. Use event.shiftKey, ctrlKey, altKey, metaKey.

Testing keyboard with keypress event (deprecated), missing non-printable keys

Why it happens: keypress is deprecated and only fires for printable keys (a-z, 0-9, punctuation). Doesn't fire for Escape, F-keys, arrow keys, modifiers. Common when using old tutorials or examples.

How to avoid it: Use keydown or keyup instead. keydown fires for all keys (letters, numbers, F-keys, arrows, modifiers). keyup fires on release. keypress is deprecated.

Assuming all keyboards have n-key rollover, breaking game controls

Why it happens: Cheap keyboards have 2-key or 6-key rollover (only 2-6 keys register simultaneously). Gaming keyboards have full n-key rollover. If game requires W + A + Space + Shift (4 keys), it fails on 2-key rollover keyboards.

How to avoid it: Test with target keyboard (cheap laptop keyboard, standard USB keyboard). Design controls to work with 6-key rollover (most keyboards support this). Avoid requiring >6 simultaneous keys.

Not handling Mac vs Windows differences (Cmd vs Ctrl, Option vs Alt)

Why it happens: Mac uses Cmd (metaKey) for shortcuts (Cmd+C), Windows uses Ctrl (ctrlKey). event.ctrlKey on Mac is not the shortcut key (users expect Cmd). Common when building cross-platform apps.

How to avoid it: Detect platform: if (navigator.platform.includes('Mac')). Use metaKey on Mac, ctrlKey on Windows. Or use event.ctrlKey || event.metaKey to support both.

Frequently asked questions

What is the difference between keyCode, key, and code?

keyCode (deprecated) = numeric (65 for 'A'). key = character ('a', 'A', 'Enter'). code = physical key ('KeyA', 'Enter'). Use key for character, code for physical location. keyCode is deprecated.

How do I detect keyboard shortcuts like Ctrl+C or Cmd+S?

Check modifier keys: if (event.key === 'c' && event.ctrlKey) for Ctrl+C. For Mac Cmd+S: if (event.key === 's' && event.metaKey). Or support both: if (event.key === 'c' && (event.ctrlKey || event.metaKey)).

What is n-key rollover and why does it matter?

N-key rollover = how many keys can be pressed simultaneously and register correctly. 2-key = basic, 6-key = standard, full n-key = gaming. Matters for gaming (WASD + Shift + Space = 5 keys). Cheap keyboards have 2-6 key rollover.

What is key ghosting?

Ghosting = unwanted key registration when holding multiple keys (hardware limitation). Example: pressing numpad 7 + 8 also registers 9. Caused by key matrix design. Common on cheap keyboards. Anti-ghosting keyboards prevent this.

How do I test if a key is stuck?

Stuck key = constantly registers as pressed. Tool highlights in red. Test: if key is highlighted without pressing, it's stuck. Causes: dirt, liquid, faulty switch. Fix: clean keyboard or replace key/switch.

Why doesn't keypress fire for Escape or F-keys?

keypress (deprecated) only fires for printable keys (a-z, 0-9, punctuation). Doesn't fire for Escape, F-keys, arrow keys, modifiers. Use keydown instead (fires for all keys).

How do I handle Mac Cmd vs Windows Ctrl?

Mac uses metaKey (Cmd), Windows uses ctrlKey. Detect platform or support both: if (event.ctrlKey || event.metaKey). For Mac-specific: if (event.metaKey && navigator.platform.includes('Mac')).

References

Privacy and availability

  • Runs entirely in your browser — zero server processing
  • No signup or account required
  • Works offline once loaded
  • Fast, lightweight, no external dependencies
  • Available as a browser extension for Chrome and Firefox