JS key codes

0 uploads — runs entirely in your browser, works offline

Click here, then press any key

JavaScript key codes — press a key, see the event

Press any key and see its JavaScript event.key, event.code and legacy keyCode, plus active modifiers. It runs in your browser (0 uploads, works offline).

How to use it

  1. Enter or paste your input above.
  2. The result appears live on your device.
  3. Copy or Download it.

FAQ

How do I find the JavaScript key code for a key?

Click the box on this page and press any key — its event.key, event.code and legacy keyCode appear instantly, in your browser with no upload, along with which modifier keys (Ctrl, Alt, Shift, Meta) were held.

What's the difference between event.key and event.code?

event.key is the character produced ("a", "Enter", "ArrowUp"), which changes with the keyboard layout; event.code is the physical key ("KeyA"), which does not. Use key for characters, code for physical positions.

Is anything uploaded?

No — key events are read and shown entirely on your device; it works offline.

Should I still use keyCode?

No — keyCode is deprecated. It is shown here for reference when reading old code, but new code should use event.key or event.code.

Limits

Reads standard keyboard events. Some keys are intercepted by the browser or OS before the page sees them.

Related

The ASCII table maps character codes; the unicode inspector analyses characters in text.

Bookmark this page (Ctrl+D, or ⌘D on Mac) or install the app — it works offline the next time you need it.