JavaScript Keyboard Event Tester

Press any key to see the JavaScript event details.

Live Keyboard Event Data

Press any key to see event details

event.key

Character value

event.code

Physical key

event.keyCode

Deprecated

Numerical code

Modifier Keys

Active modifiers

Start typing to see live keyboard event data

What is a Keyboard Event?

Understanding the fundamentals of browser keyboard input detection

How It Works

When you interact with your keyboard, your browser fires off events. These "keyboard events" can be captured by JavaScript to create rich and interactive web applications.

This Tool

This interactive tester helps you visualize the properties of a JavaScript KeyboardEvent in real-time, making it easier to understand how keyboard input works.

Understanding Event Properties

event.key

The value of the key pressed. For example, pressing the "a" key will show "a". Pressing the Shift key will show "Shift". This represents the character or key name.

event.code

Represents the physical key on the keyboard. For example, KeyA for the "a" key, regardless of whether Shift is held down. Perfect for game controls and keyboard shortcuts.

event.keyCode
Deprecated

A numerical code representing the key pressed. For example, the "a" key has a keyCode of 65. Avoid using this in new projects - prefer event.key or event.code instead.

Want to Learn More?

Dive deeper into keyboard events with our comprehensive guides and tutorials.

Explore Resources