Keyboard Event Tester

Find the JavaScript event.key, event.code, and keyCode for any key on your keyboard. Essential for keyboard event handling.

Press any key to see its event data

Features

  • event.key value
  • event.code value
  • Legacy keyCode
  • Modifier keys
  • Key history
  • One-click copy

How to Use

  1. 1
    Click anywhere on this page
  2. 2
    Press any key
  3. 3
    View all event properties
  4. 4
    Copy values you need

Frequently Asked Questions

What's the difference between key and code?

event.key represents the character ("a" or "A"), while event.code represents the physical key ("KeyA") regardless of layout.

Why is keyCode deprecated?

keyCode is deprecated because it varies between browsers and keyboard layouts. Use event.key or event.code instead.