What Key Am I Pressing?

Press any key and this page shows its event.key, event.code and legacy keyCode. For example, the A key gives key "a", code "KeyA" and keyCode 65. The Enter key gives code "Enter" and keyCode 13.

This tool needs a physical keyboard. On a phone or tablet, connect a Bluetooth or USB keyboard first.

Click this page, then press a key. Tab, Esc, F5 and F12 keep their normal job.

Press any key
event.key
-
event.code
-
event.keyCode (legacy)
-
event.location
-
Modifier keys
-
event.repeat
-

Recent presses

#keycodekeyCodeModifier keys
No keys pressed yet
Did this solve your problem?
Prefer us on Google

How to use

  1. Click anywhere on the page, then press a key on your keyboard. You do not need to click into a text box.
  2. Read the key name, the physical code and the legacy keyCode in the panel. Hold Shift, Ctrl, Alt or Cmd to see the modifier state, and hold a key down to see the repeat flag turn on.
  3. Use Copy to put the values on your clipboard for your code. The list below keeps the last ten presses.

How it works

Browsers send a keydown event for every key press. event.key is the value the key produces, such as "a", "A" or "Enter", and it changes with the keyboard layout and the Shift state. event.code is the physical key on the keyboard, such as "KeyA", and it stays the same across layouts, which makes it the right choice for game controls.

event.keyCode is the old numeric code. It is deprecated, but it is still used in older scripts and in jQuery-era code, so this tool shows it. During input method (IME) composition it reports 229. event.location says where the key sits: 0 standard, 1 left, 2 right, 3 numeric keypad.

To keep the page from scrolling or opening help while you test, the tool cancels the browser default for most keys. Tab, Escape, F5, F11, F12 and shortcuts that use Ctrl or Cmd are left alone. Keys handled by the operating system, such as Fn, volume and brightness, never reach the page.

Common key values

Keyevent.keyevent.codekeyCode
EnterEnterEnter13
Space Space32
EscapeEscapeEscape27
Arrow UpArrowUpArrowUp38
Letter AaKeyA65
Digit 11Digit149

FAQ

What is the difference between event.key and event.code?

event.key is what the key types, so it depends on layout and Shift. event.code is the physical position. On a French AZERTY keyboard, the key in the Q position reports code "KeyQ" but key "a". Use code for game controls and key for shortcuts that depend on a character.

Should I still use keyCode?

No. keyCode and which are deprecated. Use event.key or event.code in new code. The numbers are shown here so you can read or fix older scripts, where, for example, 13 is Enter, 27 is Escape, and 32 is Space.

Why does a key show 229 or "Process"?

Input methods for Chinese, Japanese, Korean and other languages take the key first while you compose text, so the browser reports 229. Switch to an English layout if you need the plain key values.

Why does my keyboard shortcut or media key not show up?

The operating system or the browser can take a key before the page sees it. Ctrl+W, Alt+Tab, Cmd+Q and the Fn row on many laptops are examples. If the page does not react, the key is not reaching web code at all.