Skip to content
Categories
Keycode Tester
Check the key, code, keyCode, and modifier keys of a key press in real time.
Click here and press a key
Overview
- Displays the key, code, keyCode, which, and modifier key (Ctrl/Alt/Shift/Meta) values from the browser's KeyboardEvent in real time as you press keys.
- Key names can differ across browsers and operating systems, so you can press the actual key to confirm the correct value.
- Also generates JavaScript conditional code that you can use directly with the confirmed values.
Usage
- Click the input area below to focus it.
- Press the key you want to check.
- The key, code, keyCode, and other values are displayed along with a sample conditional code. Use the "Copy" button to copy the code to your clipboard.
Example
Input
Press Ctrl + Shift + Enter
Output
key: "Enter", code: "Enter", keyCode: 13
if (event.key === "Enter" && event.ctrlKey && event.shiftKey) {
// ...
}Use Cases
- Checking the correct event.key/event.code value for a target key when implementing keyboard shortcuts
- Investigating differences in key names caused by browsers, operating systems, or keyboard layouts
- Confirming values when migrating from the deprecated keyCode/which to the currently recommended key/code
FAQ
Can I still use keyCode and which?
They work in most browsers but are deprecated. New implementations should use key or code instead.
What is the difference between key and code?
key represents the character produced (a logical value reflecting layout and Shift state), while code represents the physical key position. For example, Shift+1 produces a key of "!", but code remains "Digit1".
Does it react to key presses elsewhere on the page?
No. It only detects key presses while the input area is focused, and does not monitor key presses on the rest of the page.
Notes
- Key presses during IME composition (e.g. Japanese input) may report a value like key: "Process" instead of the actual character.
- Nothing is sent externally — everything is processed entirely within your browser.
Related Tools
Parse browser, OS, and device information from a User-Agent string.
Format HTML to make it easier to read.
Format CSS to make it easier to read.