Skip to main content

Keycode Info

Press any key to inspect its KeyboardEvent properties instantly.

Reviewed by · Last reviewed

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.

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.

More Developer Tools