JavaScript Keycode Finder
Press any key to get the JavaScript keycode, key, code, and other keyboard event properties. Free online keycode finder.
Press the key on your keyboard you want to get info about this key
How to Use This JavaScript Keycode Finder
- Click on the tool area to give it focus.
- Press any key on your keyboard.
- View the key name, keyCode, code, location, and modifier key states.
- Copy the displayed values for use in your JavaScript event handlers.
About Keycode Info
This tool helps web developers quickly find JavaScript keyboard event properties. When you press any key, it displays the key name, keyCode (deprecated but still useful), code (physical key identifier), location (0=standard, 1=left, 2=right, 3=numpad), and any active modifier keys.
Tip
The keyCode property is deprecated but still widely used. The 'code' property represents the physical key on the keyboard, while 'key' represents the character produced.
Key Features
- Displays event.key, event.keyCode, and event.code simultaneously
- Shows key location (standard, left, right, numpad)
- Detects modifier keys: Shift, Ctrl, Alt, and Meta
- Works with all keyboard layouts and special keys
- Real-time detection with no delay
- Helps distinguish between left and right modifier keys
- No installation or setup required
Common Use Cases
- Building custom keyboard shortcuts in web applications
- Developing browser-based games with keyboard controls
- Implementing accessible navigation with arrow keys
- Debugging keyboard event handlers and key bindings
- Finding keyCodes for international keyboard layouts
- Creating hotkey documentation for your application
Frequently Asked Questions
Why is event.keyCode deprecated?
The keyCode property is deprecated because its values are inconsistent across browsers and keyboard layouts. The modern replacement is event.key (returns the character) and event.code (returns the physical key). However, keyCode is still widely supported and used in legacy code.
What is the difference between event.key and event.code?
event.key returns the logical value of the key (e.g., 'a' or 'A' depending on Shift state), while event.code returns the physical key identifier (e.g., 'KeyA' regardless of Shift or keyboard layout). Use event.key for text input and event.code for game controls.
Do function keys and special keys have keyCodes?
Yes. Function keys (F1-F12), arrow keys, Escape, Enter, Tab, and other special keys all have assigned keyCode values. For example, Enter is 13, Escape is 27, and F1 is 112. This tool displays all of these when you press the corresponding key.