Skip to content
ZeroServer.tools

JavaScript Keycode Tester & Event Inspector

Press any key on your keyboard to instantly view JavaScript KeyboardEvent properties, code, and keyCodes.

Press any key on your keyboard…

Focus this box or anywhere on the page and hit a key

CtrlShiftAlt / OptionMeta / Cmd / Win

JavaScript Keycode Reference Search

Key Nameevent.codeevent.keyCode
BackspaceBackspace8
TabTab9
EnterEnter13
ShiftShiftLeft / ShiftRight16
ControlControlLeft / ControlRight17
Alt / OptionAltLeft / AltRight18
Pause / BreakPause19
Caps LockCapsLock20
EscapeEscape27
SpaceSpace32
Page UpPageUp33
Page DownPageDown34
EndEnd35
HomeHome36
Arrow LeftArrowLeft37
Arrow UpArrowUp38
Arrow RightArrowRight39
Arrow DownArrowDown40
InsertInsert45
DeleteDelete46
Digit 0 - 9Digit0..Digit948 - 57
Key A - ZKeyA..KeyZ65 - 90
Windows / MetaMetaLeft / MetaRight91
F1 - F12F1..F12112 - 123

How the keycode tester works

This tool listens for keydown events on the page and displays all properties from the KeyboardEvent object: event.key (the printable character or key name), event.code (the physical key position), keyCode / which (legacy numeric codes, still used in many codebases), and the four modifier-key booleans. Use event.key and event.code in modern code — keyCode is deprecated but still needed for older browser compatibility.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Finding the right `event.key` value for a keyboard shortcut.
  • Checking whether `key` or `code` is the correct property for your case.
  • Debugging a shortcut that fires on one keyboard layout and not another.
  • Inspecting modifier state alongside the key.
  • Checking what a media or a function key reports.

Frequently Asked Questions

Which property should I use — key, code or keyCode?
`key` for the character produced and `code` for the physical key. `keyCode` is deprecated and inconsistent across browsers, and it is still the one most tutorials show — which is why so much keyboard handling breaks on non-US layouts.
What is the difference between key and code?
`code` is the physical position — `KeyA` is the key where A sits on a US layout, regardless of what it types. `key` is what it actually produced, which on a French AZERTY layout is `q` for that same physical key.
Which should a game use?
`code`, because WASD is a physical shape. Using `key` means a French keyboard player has to press ZQSD to move in the same pattern, which is the classic bug in browser games ported without layout testing.
Why is keypress deprecated?
Because it never fired for non-character keys and its behaviour differed across browsers for everything else. `keydown` plus the `key` property covers what it did, and `beforeinput` covers text entry more reliably including from IME and paste.
Why does my shortcut not fire on some keyboards?
Usually a modifier or a layout difference. `Ctrl+/` requires Shift on several European layouts, so the event arrives with a different `key` — which is why matching on `code` plus modifiers is more robust for shortcuts than matching on the character.

Common errors and gotchas

  • Using the deprecated `keyCode`, which is inconsistent across browsers and no longer specified.
  • Using `code` for a character shortcut, which reports the physical key and ignores layout.
  • Using `key` for a positional shortcut such as WASD, where layout changes the character.
  • Assuming a key combination is available, when the browser or OS may claim it first.
  • Testing on one layout and shipping a shortcut that is unreachable on another.

Related Developer Utilities tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate