On this page
Key Event Tester
A live inspector for event.key, event.code, location, repeat and modifier state — built for developers.
- Available — Live on this site right now.
- Browser Tool — Runs in the browser you are reading this in.
- No Install — Nothing to download, no extension, no account.
- Client-Side — Runs entirely on your device. No test data is uploaded.
- Desktop — Needs a physical keyboard or mouse to be useful.
This page explains the tool. The tool itself is one click away and needs no sign-in.
Open Key Event TesterWhat is this tool?
Every key you press becomes a KeyboardEvent object, and this page shows you that object as it happens. It is the tool to reach for when you are writing a shortcut handler and need to know exactly what the browser is handing you.
The panel breaks each event into its useful fields: event.key (the character or name produced), event.code (the physical key, independent of layout), event.location (which of a duplicated pair fired), event.repeat (whether the operating system generated it) and the four modifier flags.
A rolling log sits underneath so you can compare a sequence rather than a single press — useful for chords, dead keys and IME behaviour.
How to use it
- Give the page focus and press a keyThe inspector fills in immediately. There is no start button; monitoring is the default state.
- Compare key against codePress the same physical key with a different keyboard layout selected in your operating system.
event.codestays the same,event.keychanges. That difference is the whole reason to usecodefor game controls andkeyfor text. - Filter to what you are debuggingALL, KEYDOWN, KEYUP, REPEAT and MODS narrow the log. MODS is the fastest way to see whether a chord's modifier flags are set the way you expect.
- Freeze and copyPAUSE MONITORING stops the stream so a fast chord stays on screen. Copy Event puts the selected event on your clipboard as JSON, ready to paste into a bug report. CLEAR empties the log and RESET SESSION starts over.
What the results mean
event.key vs event.code
On a US layout, pressing the key marked Q gives key: “q” and code: “KeyQ”. On AZERTY the same physical key gives key: “a” and still code: “KeyQ”. Bind gameplay to code; read text from key.
event.location
0 means standard, 1 left, 2 right, 3 numpad. It is how you tell left Shift from right Shift, and how you tell numpad Enter from the main Enter when they share a key value.
event.repeat
True marks an event your operating system generated because the key is being held, not a fresh physical press. Ignore repeats when you are counting presses.
Modifier flags
shiftKey, ctrlKey, altKey and metaKey describe the state at the moment of the event. A chord that fails usually fails because one of these is false when your handler assumed it was true.
What it can detect
- The exact key, code, keyCode, location and modifier state of any press
- Whether an event came from your finger or from operating-system auto-repeat
- Layout-dependent differences between key and code
- Left and right variants of duplicated keys, and numpad versus main-block keys
Limits worth knowing
A browser can only report what the platform gives it. These are the honest boundaries of this page, so a result is never read as more than it is.
- This tool does not measure hardware latency, and its own FAQ says as much. Event timestamps include operating-system and browser scheduling, so they describe when the browser saw the key — not how fast the switch or the cable is.
- Shortcuts the browser or operating system claims first — Ctrl+W, Alt+Tab, Cmd+Q and similar — never reach the page and so cannot be inspected here.
- The Fn key on most laptops is resolved inside the keyboard controller and never becomes a browser event.
Tips
- When you write a shortcut handler, check the modifier flags rather than watching for the modifier's own keydown. The flags are set on the event you actually care about.
- Use PAUSE MONITORING before reading a fast chord; otherwise the keyup events push the interesting frame off the top.
- If you need press timing rather than press identity, the Key Press Test measures hold duration and press-to-press intervals.
Troubleshooting
My shortcut does not show up
The browser or the operating system intercepted it before the page could see it. Ctrl+W, Ctrl+T, Alt+F4 and Cmd+Q are typical examples. Pick a combination the platform does not reserve.
keyCode is deprecated — why is it here?
Because a great deal of existing code still reads it, and seeing the value alongside the modern fields makes migrating easier. Write new code against key and code.
The same key gives a different event.key on my Mac
Option-modified keys produce different characters on macOS. event.code stays stable, which is why layout-independent logic should use it.
Are the events stored anywhere?
No. Everything is inspected in your browser; only your own view preferences are kept locally. Nothing is uploaded.
Ready to run it?
A live inspector for event.key, event.code, location, repeat and modifier state — built for developers. Nothing to install, and it opens in this browser.