Keycode tester
Press any key to see exactly what the browser reports in its keyboard event: the key value, the physical code, the legacy keyCode, the location, held modifiers, lock keys and the repeat flag. Useful for web development, key mapping and identifying an unknown key.
Press any key. Start full capture to also inspect Tab, Space, F-keys and shortcuts (Esc twice or Stop to exit).
event.key- —
event.code- —
event.keyCode- —
event.location- —
Modifiers- —
Lock keys on- —
event.repeat- —
event.keyCode and event.which are deprecated but still reported by browsers; use event.code for physical keys and event.key for the character produced.
Event log (last 80)
| type | key | code | keyCode | location | repeat | Modifiers |
|---|
How to use the keycode tester
- Press any key. The large box shows the key value and the fields beside it show
event.key,event.code,event.keyCode,event.location, held modifiers, lock keys that are on, andevent.repeat. - Press Start full capture to also inspect keys the browser normally uses itself, such as Tab, Space, F-keys and many shortcuts. Press Esc twice quickly, or Stop, to exit.
- Open the event log to see the last 80
keydownandkeyupevents in order, for example to check a key combination. - Press Copy last event (JSON) to paste the values into a bug report or code. Clear log empties the list.
What each value means
key: the character or key name produced, after layout and modifiers. Shift+2 gives"@"on a US layout and'"'on a UK layout.code: the physical key, named after its position on a US QWERTY keyboard. On a French AZERTY keyboard the key labelled A reportsKeyQ. Use it for game controls and shortcuts tied to position.keyCode(andwhichin the JSON): legacy numbers that are deprecated but still reported. They differ between layouts and browsers; preferkeyorcodein new code.location: 0 standard, 1 left, 2 right, 3 numpad. It tells left from right Shift, Ctrl, Alt and Meta, and keypad keys from the number row.- Modifiers and lock keys: Control, Shift, Alt and Meta held during the event, and whether Caps Lock, Num Lock or Scroll Lock is on, as reported by
getModifierState(). repeat: yes for auto-repeated events while a key is held.
Common surprises
Dead: accent keys on many international layouts produce no character until the next key, sokeyisDead.Processor keyCode 229: an input method (for example for Chinese or Japanese, or some phone keyboards) is composing text and the real key is hidden.- AltGr on Windows usually arrives as Control plus Alt, so you may see two events and both modifiers.
- Mac Command key: while Command is held, the browser does not report key releases of other keys.
- Empty
codeorUnidentified: the keyboard, driver or remote session did not supply a physical key. The Fn key never appears at all because it is handled inside the keyboard.
Limits
The page shows what the browser exposes, after the operating system and keyboard layout have processed the key. It cannot show raw scan codes or USB HID data, cannot see keys the operating system takes first (such as Ctrl+Alt+Del), and does not change or remap keys. It also does not measure keyboard latency or polling rate. To check that every key on a keyboard works, use the keyboard test; for several keys at once, the ghosting test.
Questions
What is the difference between key and code?
code names the physical key position and stays the same whatever the layout. key is what that press produces with the current layout and modifiers, for example a, A or @.
Is keyCode still safe to use?
Browsers still report it, but it is deprecated and inconsistent across layouts and browsers. Use event.key for characters and event.code for physical positions.
Is what I type sent anywhere?
No. Events are shown on this page only and disappear when you close the tab. Copying the JSON puts it in your own clipboard.
Related tests
- Keyboard testPress every key and see which ones register, with ANSI, ISO and Mac layouts.
- Ghosting testHold several keys at once and see which combinations your keyboard can report.
- Chatter testFind keys that type twice: each press timed, repeats too fast for a finger flagged.
- Numpad testPress every key on the numeric keypad and see whether it registers, with the Num Lock state shown.
- Mac keyboard testKeyboard test with Mac key names, for MacBook keyboards and the Magic Keyboard.
- Spacebar speed testSee how many times you can press the spacebar in 5 to 60 seconds; held keys do not count.