Keycode Info

Web

Show the key code and event details for any keypress (keyCode, key, code, location). Build shortcuts and game controls with the right codes.

Press any key
Press any key…

About Keycode Info

Handling keyboard events in a web page means knowing each key's key, code, and the deprecated keyCode, which is hard to recall from memory. This tool listens to your real key presses locally in your browser and shows the live event.key, event.code, keyCode, location, and Ctrl/Shift/Alt/Meta modifier states, so you can build shortcuts and debug input logic. Every keystroke is captured and handled only on this page and is never logged or sent anywhere. Tip: Bookmark this tool for quick access during your web development work. All processing happens locally in your browser with no installation required.

How to Use

  1. Open the Keycode Info tool page
  2. Enter or paste your data into the input area
  3. View the real-time results and use the copy button to get the output

Use Cases

  • Build shortcuts — Measure the key and code a combo produces and write the keydown listener without guessing.
  • Tell keys apart — Use code to distinguish left vs right Shift, or main-row vs numpad digits that share a name.
  • Legacy mapping — Find the modern key/code for an old keyCode value to migrate smoothly to the new API.
  • Layout checks — Verify the key produced by one physical key under different keyboard layouts.
  • Game controls — Confirm the code values when mapping WASD for a web game so input methods do not interfere.
  • Keyboard shortcut testing — Verify the exact key codes fired by a keyboard shortcut combination to debug event handler conflicts.
  • Cross-browser comparison — Compare key codes across different browsers to ensure your keyboard event handling works universally.

FAQ

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

key is the character or meaning the press yields and changes with layout and Shift (a vs A); code is the physical key position and is layout-independent (KeyA is always the same physical key). Shortcuts are usually more robust using code.

Why is keyCode discouraged now?

keyCode is deprecated by the standard, its values differ across browsers and layouts, and it survives only for legacy compatibility. New projects should use key or code.

What is the location field for?

location marks the position of same-named keys — left Ctrl is 1, right Ctrl is 2, numpad keys are 3 — letting you tell the main keyboard and numpad apart for the same symbol.

Why can't some combinations be captured?

Some combos are intercepted first by the OS or browser (certain F keys, system shortcuts) and never bubble to the page; this is a platform limit a web page cannot override.

Are key values reliable during IME input?

During composition for languages like Chinese, isComposing is true and key may be Process; handle input after compositionend to avoid misreading keys.

Any browser compatibility requirements?

This tool works in all modern browsers (Chrome, Firefox, Edge, Safari). No plugins or extensions required.

Can I use it offline?

After initial load, most features work offline. The core logic runs entirely in your browser with no network dependency.

Advertisement

Comments

No comments yet. Be the first!

Comments are stored locally in your browser. Configure Giscus for cloud-based comments.