Recherche de codes touches JavaScript
Press any key on your keyboard to see its JavaScript event properties.
Key History
How It Works
- Press any key: Click in the input area and press any key on your keyboard — letters, numbers, function keys, arrows, modifiers, or special keys.
- Read the key codes: The tool instantly displays the key's event.key, event.code, event.keyCode (legacy), and charCode values.
- Use in your code: Copy the exact values you need for your keyboard event listeners or shortcut implementations.
Why Use Keycode Finder?
JavaScript keyboard events expose several different properties — key, code, keyCode, charCode, and which — and knowing which to use and what value to compare against is consistently tricky. The KeyCode Finder eliminates guesswork by letting you press a key and immediately see all its event properties. This is invaluable for building keyboard shortcuts, handling special keys, implementing hotkeys, and debugging keyboard event listeners.
Features
- All event properties: Shows event.key, event.code, event.keyCode, event.which, and event.charCode for every keypress.
- Modifier key detection: Displays whether Shift, Ctrl, Alt, and Meta were held during the keypress.
- Special key support: Works with function keys (F1–F12), arrow keys, Enter, Escape, Tab, Backspace, and all other special keys.
- Key history: Keeps a log of recent keypresses so you can compare multiple keys.
- Copy values: Click any value to copy it directly to your clipboard.
Frequently Asked Questions
What is the difference between event.key and event.keyCode?
event.key is the modern standard — it returns a readable string like "ArrowLeft" or "Enter". event.keyCode is a legacy numeric code (deprecated but still supported). Use event.key for new code; use event.keyCode when maintaining older browser compatibility.
How do I detect Ctrl+S or other key combinations?
Keyboard combinations use event.key combined with modifier checks: if (event.ctrlKey && event.key === "s"). Press Ctrl+S in this tool to see all the values, then replicate the exact condition in your event listener.
Why do some keys show the same keyCode?
keyCode values were not standardized and some keys share codes depending on context. event.code is more reliable — it identifies the physical key position (e.g., "KeyA") regardless of the keyboard layout, while event.key reflects what character that key produces.