Keycode Finder
Look up the key, code and keyCode values for a keyboard key used in JavaScript keydown and keyup events. Type a key name, a single character or a numeric keycode.
1 Fill in the box
2 Your answer
Your answer shows here as you type.
How to use the Keycode Finder
- Type a key name such as Enter or ArrowLeft, a single character such as a, or a numeric keycode such as 13.
- Read the key, code and keyCode values in the results.
- Use the key value to match the character typed, and the code value to match the physical key position.
Frequently asked questions
What is the difference between key, code and keyCode?
The key value is the character or name produced by the key, such as a or Enter. The code value names the physical key position, such as KeyA or Enter, and does not change with the keyboard layout. keyCode is an older numeric value, such as 65 for the A key. It is deprecated, but browsers still report it.
How do I get the keycode of a key in JavaScript?
Add a listener such as document.addEventListener('keydown', e => console.log(e.key, e.code, e.keyCode)) and press the key. The values appear in the browser console.
Why do punctuation keycodes differ between browsers?
Older browsers used different numbers for punctuation keys such as semicolon, equals and minus. The values in this tool follow the common Chrome and Safari numbering, so check keyCode in the browsers you support.
How do numpad keys differ from the main number keys?
Both produce the same key value, such as 5, but the code differs: Digit5 for the main row and Numpad5 for the numpad. keyCode is also different, 53 for the main row and 101 for the numpad.
Wrote something with AI? Slop Monkey rewrites it so it sounds like you, and keeps your facts.