Javascript key code identifier
Identify JavaScript codes of the pressed keys on a keyboard.
This tool processes all data locally on your device.
Input
Output
Guide
What are JavaScript key codes?
When you press a key, the browser sends a keyboard event that JavaScript reads in handlers such as onkeydown. The event names the key in more than one way:
keyis what the key types or does, such asa,A,!,EnterorArrowUp. It follows the keyboard layout and Shift, so use it for text and shortcuts.codeis the physical key, such asKeyAorDigit1, named after its place on a US keyboard whatever the layout. Use it for game controls like WASD.keyCodeis an older number, such as 13 for Enter. It's deprecated, but plenty of existing code still uses it.
On a French AZERTY keyboard, for example, the key where a US keyboard has Q types "a", so key is a and code is KeyQ.
Tool description
Press any key while the page is open, and the tool shows its Key and Code, whether the Ctrl, Shift, Alt and Meta keys were held down, and the deprecated keyCode. Each value has a copy button. Tick Prevent default to stop the browser's own action for a key, such as F5 reloading the page or Tab moving the focus, so you can test those keys too.
Features
- The
key,codeandkeyCodeof every key you press - Which modifier keys were held: Ctrl, Shift, Alt (Option on a Mac) and Meta (the Windows key or Command)
- A Prevent default option for testing keys the browser normally acts on
Tips
- The browser and the operating system keep some shortcuts for themselves, such as closing the tab or switching windows, and Prevent default can't stop those.
- Shift changes
keybut notcode: on a US layout, Shift with 1 gives the key!and the codeDigit1.
Comments
Tool info
Created
Last updated
Tags
javascriptkeycodeidentifiereventhandlingkeyboardjs
Similar Tools
Transform JavaScript code to make it difficult to understand and reverse-engineer while preserving functionality
Combine and merge multiple JSON arrays into one. Choose between simple concatenation or merging with unique elements only.
Merge and combine multiple JSON objects with shallow, deep, or overwrite strategies. Perfect for configuration merging and data consolidation.
Embed
Embed this tool anywhere for free. Need help? Check out our guide.
Disclaimer
The tools provided on this website are designed to assist users in solving various problems. While we strive to ensure that the tools are accurate and effective, we do not guarantee or warrant that the output of any tool will be 100% accurate or error-free. The results generated by these tools are provided as-is and should be used with caution. We recommend that users verify any important information or results with additional resources or professional advice, as we cannot be held responsible for any consequences arising from the use of these tools. By using this website, you agree to assume all risks associated with the accuracy and use of the results provided.