Skip to content
Mediawand

JavaScript Keycode Finder

Building a keyboard shortcut or a game? Press a key and see exactly what the browser reports for it: event.key, event.code, the old keyCode, which side of the keyboard, and any modifier keys held.

How to find a key code

  1. 1Click the box so it has focus.
  2. 2Press the key, or a combination like Ctrl+Shift+K.
  3. 3Copy the values you need.

key or code?

event.key is the character or name produced, like “a”, “A” or “Enter”, and changes with the keyboard layout. event.code is the physical key, like “KeyA”, and stays the same on any layout, which suits game controls.

keyCode is deprecated

keyCode and which still appear in old code, so they're shown, but new code should use key and code.

Left or right

location tells left and right Shift, Ctrl and Alt apart, and the numpad from the main keys.

Frequently asked questions

Is anything sent to a server?
No. Everything runs in your browser.
Why doesn't Tab show up?
It does, but it also moves focus out of the box, so keyboard users can always leave. Click the box again to continue.
Why do some shortcuts do nothing?
The browser or operating system keeps some combinations for itself, like Ctrl+W or Cmd+Q, before the page sees them.

Related tools

Loading tools…