Skip to content

Keycode Info

Press any key to see its JavaScript keyCode, key, code, which, and location event properties.

Loading...
1. Click anywhere on the tool area to give it keyboard focus. 2. Press any key on your keyboard to instantly see all its event properties displayed. 3. Review the key, code, keyCode, which, and location values shown in the output panel. 4. Hold modifier keys (Ctrl, Shift, Alt, Meta) while pressing another key to see how modifier states change. 5. Use the copy button to copy the event property values for use in your JavaScript event handler code.

About This Tool

Keycode Info is an interactive tool for web developers working with keyboard events. Simply press any key on your keyboard and instantly see all the relevant JavaScript event properties: key, code, keyCode (deprecated but still widely used), which, location, and boolean modifier states (ctrlKey, shiftKey, altKey, metaKey).

Keyboard event handling is notoriously tricky in web development. The event.key property gives you the character produced, event.code gives the physical key location, and the legacy event.keyCode gives a numeric code. This tool shows all of these simultaneously so you can determine exactly which properties to use in your event handlers.

The tool also displays the event type (keydown, keypress, keyup), helps identify special keys like function keys and media keys, and shows how modifier combinations affect the output. It is invaluable for building keyboard shortcuts, game controls, accessibility features, and custom input handling.

Frequently Asked Questions

event.key returns the character value of the key (like "a" or "Enter"), which changes based on keyboard layout and modifiers. event.code returns the physical key identifier (like "KeyA" or "Enter"), which stays the same regardless of layout. Use key for text input and code for shortcuts.
Yes, event.keyCode is deprecated in favor of event.key and event.code. However, it is still widely supported and used in legacy code. New projects should use event.key for character input and event.code for physical key identification.
The keypress event only fires for keys that produce a character value. Special keys like Shift, Control, Arrow keys, and function keys only trigger keydown and keyup events. The keypress event is also deprecated - use keydown instead.
Check the boolean properties on the keyboard event: event.ctrlKey, event.shiftKey, event.altKey, and event.metaKey (Command on Mac). Combine these with event.key or event.code to detect shortcuts like Ctrl+S.

Related Tools

Regex Tester

Test regular expressions with real-time match highlighting, group capture display, and a pattern library.

Developer Tools

HTML Entity Encode and Decode

Convert special characters to HTML entities and decode HTML entities back to readable text.

Developer Tools

HTTP Status Codes Reference

Search and browse all HTTP status codes with descriptions, use cases, and common troubleshooting tips.

Web and SEO Tools