Keycode Info
Press any key to inspect its KeyboardEvent properties instantly.
Reviewed by ZeroUtil Editorial Team · Last reviewed
Runs 100% in your browser - your data never leaves your device
How to Use Keycode Info
- Click the capture field to focus it.
- Press any key on your keyboard. The table below updates instantly with that key's KeyboardEvent properties.
- Read the properties including key, code, keyCode, location, and any active modifier keys (Ctrl, Alt, Shift, Meta).
What This Tool Does
Keycode Info attaches a keydown listener to a focused input and captures the full KeyboardEvent data when you press a key. It displays key (the logical value), code (the physical key position), the deprecated keyCode and which values, location (distinguishing standard, left, right, and numpad keys), and all four modifier flags. No data is sent to any server - everything runs in your browser.
When You Need It
- Writing keyboard shortcuts. Confirm exactly what
event.keyandevent.codereport for your target combo before wiring up a handler - especially for keys like/,?, or dead keys that vary by layout. - Migrating off keyCode. Older codebases branch on numeric keyCode values. Press the key, read the modern equivalent, and replace the magic number with
event.keyorevent.code. - Debugging international layouts. On AZERTY or QWERTZ, the physical KeyA position produces a different character. Comparing key against code makes the layout dependence visible immediately.
- Game controls. Games should use
event.codeso WASD stays in the same physical position on every layout; verify your assumptions here first.
Quirks to Watch For
Some keystrokes never reach the page: browsers reserve combos like Ctrl+W and Ctrl+T, and operating systems swallow others (PrintScreen often fires no keydown at all). Media keys and Fn are inconsistent across platforms. Modifier-only presses report the modifier as the key itself (key: "Shift", location: 1 or 2). And in older Safari versions some special keys still report nonstandard key values, which is exactly the kind of difference this inspector makes obvious.
Frequently Asked Questions
What is the difference between event.key and event.code?
event.key returns the value of the key (e.g. "a", "Enter", "ArrowUp") and is layout-dependent - it changes based on the OS keyboard layout. event.code returns the physical key position (e.g. "KeyA", "Enter", "ArrowUp") and is layout-independent. Use event.code when you want to respond to a physical key regardless of what character it produces.
Why is keyCode deprecated?
keyCode is a legacy property from before the KeyboardEvent spec was standardized. It returns inconsistent numeric values across browsers for non-printable keys. The modern replacement is event.key (for the value) and event.code (for the physical key). keyCode is still displayed here because it is widely used in existing codebases.
What does location mean?
location identifies where on the keyboard the key is physically located: 0 = Standard (most keys), 1 = Left modifier, 2 = Right modifier, 3 = Numpad. Useful for distinguishing left Shift from right Shift.
Related tools
- URL Encoder / Decoder
Online URL encoder and decoder for query strings, paths, and HTTP request values - percent-encodes characters with encodeURIComponent.
- HTML Entity Encode / Decode
Encode special characters to HTML entities or decode them back.
- Regex Tester
Test regular expressions with live highlighting, matches and capture groups.
- JavaScript Formatter / Minifier
Format, beautify and minify JavaScript code with Prettier-style defaults.
- Unicode Text Converter
Convert text to bold, italic, script, fraktur and other Unicode styles.
More Developer Tools
AI Token Counter
Count tokens for GPT-4o, Claude, and Gemini models instantly.
Open toolBase64 Encoder & Decoder
Encode UTF-8 text to Base64 online or decode Base64 back to UTF-8 and plain text. Runs in your browser with no upload.
Open toolBulk URL Encode / Decode
Encode or decode many URLs at once. Paste a newline-separated list and the tool processes each line in parallel, preserving order and blank lines.
Open toolchmod Calculator
Calculate and convert Unix file permission modes between octal and symbolic.
Open toolCode Screenshot
Create beautiful code snippet images with customizable themes.
Open toolColor Converter
Convert colors between HEX, RGB, HSL and CMYK formats.
Open tool