JavaScript Keycode Finder

Press any key and see its JavaScript key code, key name and event details.

Identifying a key for your code

When you write keyboard handling in JavaScript, you need to know exactly what a key reports — its key value, its code, and the other properties an event carries. This shows all of that the instant you press a key, so instead of guessing or looking it up, you press the actual key and read the values your code will receive.

Press any key and its event details appear.

The modern properties to use

Keyboard events have several properties, and knowing which to use matters. The modern, recommended ones are key, which gives the character or named key produced, and code, which identifies the physical key regardless of layout — useful for game controls where position matters. The older numeric keyCode is deprecated and inconsistent across browsers, so new code should avoid it. Seeing the live values for a real key press is the reliable way to write handling that responds to exactly the right key.

JavaScript Keycode Finder FAQ

Which key property should I use in modern JavaScript?

key for the character or named key produced, and code for the physical key. The old numeric keyCode is deprecated.

What is the difference between key and code?

key is what the key produces given the layout; code is the physical key regardless of layout, useful for position-based controls.

Is anything captured or uploaded?

No. Key presses are read and shown in your browser only.

More Developer tools