🔧

Keyboard Event Codes

Press any key to get its keyCode, code, and key values.

Click here, then press any key

How to Use

  1. Click the key detection zone on the page to focus it, then press any key on your keyboard.
  2. View the three key properties instantly: key (the logical character), code (the physical key name), and keyCode (the legacy numeric value), plus any active modifier keys.
  3. Copy any property value. Prefer event.code or event.key in new code — keyCode is deprecated and should be avoided.

Frequently Asked Questions

What is the difference between key, code, and keyCode?
key returns the logical value (e.g. 'A' or 'Enter'), code returns the physical key position (e.g. 'KeyA' or 'ArrowUp'), and keyCode is a legacy numeric identifier. Use key or code in modern JavaScript.
Why is keyCode deprecated?
keyCode is inconsistent across browsers and keyboard layouts. The newer key and code properties are more reliable and are recommended by the W3C.
Does it record a history of pressed keys?
Yes — the last 8 keys you pressed are shown in the Recent Keys section below the main result.