digtools
⌨️
keycode checker,

Keycode Checker

Instantly get keyboard event data(event.key, event.code, etc.) in your browser.

🔒️
Client-side only
No data sent to server
⚡️
Instant check
Press any key to view
🛑
Prevent Default
Test browser defaults
Press any key...
event.key
-
event.code
-
event.keyCode Deprecated
-
event.which Deprecated
-
event.location
-
Modifiers
Ctrl
Shift
Alt
Meta (Win/Cmd)
History
key code keyCode
Key history will appear here
Copied!
about,

About Keycode Checker

Keycode Checker is a developer tool that allows you to instantly check how the keyboard keys you press in your browser are recognized as event data within JavaScript.

In frontend development, accurate key detection is required when implementing shortcut keys or game controls based on user input. With this tool, you can get key properties like event.key, event.code, and event.keyCode at a glance and copy them with a single click. It's also easy to test the behavior of different keyboard layouts (such as JIS vs US) and combinations with modifier keys like Shift and Ctrl.

You can also check your keyboard input history and safely test the suppression of browser default actions (such as Tab movement or Space scrolling) within the browser when e.preventDefault() is enabled.

how to,

How to Get and Check Keycodes

STEP 1

Press a key

With this page open, simply press the physical keyboard key you want to check.

STEP 2

Check results and test

The pressed key will be displayed large in the center, and its properties like event.key and event.code will appear below. You can also turn on "Prevent Default" to test browser behavior.

STEP 3

Copy the code

Click the retrieved value to instantly copy it to your clipboard for use in your source code. You can also view recent keypresses in the history list.

glossary,

Keyboard Event Glossary

event.key
Represents the character or function actually inputted by the user. For example, pressing Shift + 1 on a US keyboard yields ! as the event.key. It is the most recommended property for evaluating logical input.
event.code
Indicates the physical position of the key pressed. Regardless of the keyboard language layout, pressing the key in the "A" position will always return KeyA. This is highly useful for actions dependent on physical layout, like WASD movement in games.
event.keyCode / event.which
Returns a system-specific numerical code assigned to the pressed key (e.g., 65 for A). Although long used in JavaScript development, these are now deprecated. They should only be used for backward compatibility checks.
event.location
A number indicating the physical region of the keyboard where the key was pressed. It can distinguish between standard keys (0), left modifiers (1), right modifiers (2), and numpad keys (3).
preventDefault()
A JavaScript method used to cancel the browser's default behavior triggered by an event, such as scrolling down the page when the Space key is pressed.
faq,

Frequently Asked Questions (FAQ)

Q.Can I use this on a smartphone or tablet?
It works properly if you have a physical keyboard connected. However, with an on-screen software keyboard, the keydown event may not fire correctly depending on the OS or browser implementation, or it may always return the same keycode (e.g., 229). This tool is intended for use with physical keyboards.
Q.Should I use event.key or event.code?
It depends on your use case. If you want to evaluate the meaning of the key or the character inputted (e.g., 'Press Enter to submit'), use event.key. On the other hand, if you want to base actions on the physical position on the keyboard (e.g., 'Move character with W, A, S, D'), using event.code is the best practice.
Q.Can I prevent shortcuts like F5 or Ctrl+W?
Even if you use JavaScript's e.preventDefault(), you may not be able to completely prevent powerful shortcut keys reserved at the security or OS/browser level, such as closing tabs, reloading windows, or opening browser developer tools.
Q.Why is event.keyCode deprecated?
Because the numerical value returned can vary depending on the browser, OS, and keyboard layout, leading to compatibility issues. It is currently recommended to use event.key or event.code.
Q.Is the inputted key data sent to a server?
No, it is not sent. All processing is completed using JavaScript within your browser, and your key input history is never sent to or saved on any external server.
use cases,

Common Use Cases

Here are typical development scenarios where checking keycodes is necessary.

⌨️

Implementing Web App Shortcuts

When implementing shortcuts like "Ctrl + S" to save or "Escape" to close a modal, this tool helps you build accurate conditional statements combining event.key and modifiers (Ctrl, Alt, Shift, Meta).

🎮

Browser Game Controller Development

In action games, when registering event listeners for user input (like WASD movement or Space to jump), use this tool to verify and implement layout-independent event.code values.

🌐

Cross-Browser Layout Compatibility Testing

Use it to check output differences for event.key when pressing symbol keys (like @ or +) across different layouts (e.g., JIS vs US keyboards) to design bug-free input forms.

🛑

Disabling Specific Key Inputs

Helpful for testing preventDefault() to block unintended form submissions with Enter, or to restrict input fields to numbers only.

Send Feedback

Please let us know your thoughts to help us improve the tool.

Disclaimer

The tools provided on this site are completely free to use, but please use them at your own risk. We make no guarantees regarding the accuracy, completeness, or safety of any calculation results, conversion results, or generated data. Please be aware that the operator assumes no responsibility for any damages or troubles caused by the use of these tools. Most tools process files and calculations locally in your browser, meaning your inputted data is neither sent to nor stored on our servers.