Live JavaScript key tester

Keyboard Event & Key Code Viewer Online

Press any key to reveal its JavaScript KeyboardEvent values instantly, including event.key, event.code, keyCode, location and active modifiers.

Listening for your keyboard
You pressed
Any key
Ready. Use your physical keyboard.

Physical key position

Waiting for input

The viewer is active across this page. Your keystrokes stay in this browser and are never saved.

CtrlShiftAltMeta

Recent keydown events

Newest first · up to 8
KeyCodeKey codeLocationModifiers
Your recent key events will appear here.

Private by design: keyboard data is processed locally and never stored.

How to use the keyboard event viewer

Test a single key, a shortcut or a keyboard layout in seconds. There is nothing to install and no form to submit.

1

Press any key

The viewer listens anywhere on this page, so you can start immediately with a physical keyboard.

2

Read every value

Compare the logical key, physical code, numeric legacy values, location and modifier state.

3

Copy what you need

Select a value card to copy one property, or copy the complete event as formatted JSON.

Understanding JavaScript keyboard events

The modern KeyboardEvent API separates what a key means from where it sits on a physical keyboard. That distinction matters for shortcuts, games, international layouts and accessible interactions.

PropertyWhat it tells you
event.keyThe character or action produced, such as a, A, Enter or ArrowLeft. It can change with Shift and keyboard layout.
event.codeThe physical key position, such as KeyA or Numpad1. It stays tied to the same key location across layouts.
keyCodeA deprecated numeric value kept for testing and maintaining older websites. Prefer key and code in new code.
locationShows whether the key is standard, on the left or right side, or on the numeric keypad.

Keyboard event viewer FAQ

What is the difference between event.key and event.code?

event.key describes the character or action produced. event.code identifies the physical key position. A different keyboard layout can change key while code stays the same.

What are keyCode and which?

keyCode and which are legacy numeric properties. They are useful when debugging older code, but both are deprecated. New JavaScript should generally use event.key and event.code.

Does this online key code viewer store my keystrokes?

No. Key event details are processed only in your browser. The short history disappears when you clear it, leave the page or reload.

Why does a browser shortcut still run?

The viewer observes keyboard events without blocking normal browser behavior. Shortcuts such as refresh, find, close tab or open developer tools may still run.

Why does my phone show no keyboard event?

This tool is designed for physical keyboards. On-screen mobile keyboards do not always emit the same browser events, so connect a hardware keyboard for reliable testing.

Try other developer tools

Test, format and debug faster with these free online utilities.

See all tools →