Skip to main content

Keycode Info

Press any key to inspect its KeyboardEvent properties instantly.

Reviewed by · Last reviewed

Runs 100% in your browser - your data never leaves your device

Rate this tool
Be the first to rate

How to Use Keycode Info

  1. Click the capture field to focus it.
  2. Press any key on your keyboard. The table below updates instantly with that key's KeyboardEvent properties.
  3. Read the properties including key, code, keyCode, location, and any active modifier keys (Ctrl, Alt, Shift, Meta).

What This Tool Does

Keycode Info attaches a keydown listener to a focused input and captures the full KeyboardEvent data when you press a key. It displays key (the logical value), code (the physical key position), the deprecated keyCode and which values, location (distinguishing standard, left, right, and numpad keys), and all four modifier flags. No data is sent to any server - everything runs in your browser.

When You Need It

  • Writing keyboard shortcuts. Confirm exactly what event.key and event.code report for your target combo before wiring up a handler - especially for keys like /, ?, or dead keys that vary by layout.
  • Migrating off keyCode. Older codebases branch on numeric keyCode values. Press the key, read the modern equivalent, and replace the magic number with event.key or event.code.
  • Debugging international layouts. On AZERTY or QWERTZ, the physical KeyA position produces a different character. Comparing key against code makes the layout dependence visible immediately.
  • Game controls. Games should use event.code so WASD stays in the same physical position on every layout; verify your assumptions here first.

Quirks to Watch For

Some keystrokes never reach the page: browsers reserve combos like Ctrl+W and Ctrl+T, and operating systems swallow others (PrintScreen often fires no keydown at all). Media keys and Fn are inconsistent across platforms. Modifier-only presses report the modifier as the key itself (key: "Shift", location: 1 or 2). And in older Safari versions some special keys still report nonstandard key values, which is exactly the kind of difference this inspector makes obvious.

Frequently Asked Questions

What is the difference between event.key and event.code?

event.key returns the value of the key (e.g. "a", "Enter", "ArrowUp") and is layout-dependent - it changes based on the OS keyboard layout. event.code returns the physical key position (e.g. "KeyA", "Enter", "ArrowUp") and is layout-independent. Use event.code when you want to respond to a physical key regardless of what character it produces.

Why is keyCode deprecated?

keyCode is a legacy property from before the KeyboardEvent spec was standardized. It returns inconsistent numeric values across browsers for non-printable keys. The modern replacement is event.key (for the value) and event.code (for the physical key). keyCode is still displayed here because it is widely used in existing codebases.

What does location mean?

location identifies where on the keyboard the key is physically located: 0 = Standard (most keys), 1 = Left modifier, 2 = Right modifier, 3 = Numpad. Useful for distinguishing left Shift from right Shift.

Related tools

More Developer Tools

Support ZeroUtil