Explore all Mouse & Keyboard Tools

JavaScript KeyCode & Event Inspector – Test Keyboard Key Codes

Press any key to inspect JavaScript KeyboardEvent properties: event.key, event.code, keyCode / which, location, and modifier states with minimal lag.

JS Keyboard Event Inspector:DOM Level 3 Events
PRESS ANY KEY ON YOUR KEYBOARD TO INSPECT

Instantly captures JavaScript KeyboardEvent properties (event.key, event.code, keyCode, location) and modifier states.

Recent Key History Stream (Last 10):0 events

No key events recorded yet. Press any key to start inspecting.

RunMacro Bot
⚡ Global Desktop Trigger Engine

Automate Global Desktop Triggers with JavaScript KeyCodes

Turn inspected event.code and virtual keycode values into global hotkey triggers across your entire operating system.

How to Inspect JavaScript Key Codes & Events

1

Press Any Key

Type any key, number, function key, or modifier on your physical keyboard.

2

Read KeyCode Properties

Inspect event.key, event.code, keyCode/which values, and keyboard location in the real-time HUD cards.

3

Copy or Review Stream

Click on any value to copy it directly to your clipboard or review the 10 most recent key events in the table.

Realistic KeyCode & Event Property Inspections

Sample event payloads showing physical scancode vs localized character interpretation.

Inspecting Enter / Return Event Payload

Example 1
Test Action

Pressing Main Enter key on ANSI keyboard layout.

Measured Result

event.key: "Enter" | event.code: "Enter" | keyCode: 13 | which: 13 | location: 0 (Standard).

Analysis & Interpretation: Standard physical position and value. Modern JavaScript web apps should check event.key === "Enter" instead of deprecated keyCode 13.

Numpad vs Main Enter Location Discrimination

Example 2
Test Action

Pressing Numpad Enter on right numeric keypad.

Measured Result

event.key: "Enter" | event.code: "NumpadEnter" | keyCode: 13 | location: 3 (NUMPAD).

Analysis & Interpretation: event.code allows developers to distinguish physical key locations even when event.key returns the identical character.

Modern W3C KeyboardEvent Property Guide

Understanding event.key, event.code, and deprecated keyCode values.

event.key (Printed Character / Logical Value)

Represents the actual character produced, taking into account Shift, CapsLock, and OS language layouts.

Impact: Recommended property for general text input handling in modern web applications.

event.code (Physical Hardware Scancode)

Identifies the physical key on the keyboard, independent of the active keyboard layout.

Impact: Essential for game controls (WASD) and desktop automation hotkey listeners.

keyCode / which (Deprecated Numeric Code)

Legacy numeric code (e.g. 13 for Enter, 27 for Escape, 32 for Space).

Impact: Preserved for maintaining backward compatibility with legacy scripts.

JavaScript KeyboardEvent DOM Level 3 vs Legacy Spec Reference

Standard W3C KeyboardEvent property definitions, legacy deprecation status, and location enum mappings.

Event PropertyType & SpecificationStandard Value ExampleW3C Status & Purpose
event.keyString (DOM Level 3)"h", "Enter", "ArrowUp"Standard (Represents printed character or semantic key value)
event.codeString (DOM Level 3)"KeyH", "Digit1", "NumpadEnter"Standard (Represents physical key position on keyboard layout)
event.keyCode / whichInteger (Legacy)72, 13, 32Deprecated (Inconsistent across non-QWERTY international layouts)
event.locationNumber (0, 1, 2, 3)0 (Standard), 1 (Left), 2 (Right), 3 (Numpad)Standard (Identifies physical origin of duplicated keys like Shift or Enter)

IME Input Composition & International Keyboards

Handling Input Method Editors (Vietnamese Telex/VNI, CJK) and virtual keys.

IME Composition State (event.isComposing)

When typing with active IME (e.g., Unikey, EVKey), intermediate composition strokes return event.key === "Process" or keyCode === 229.

Recommended Workaround: Inspect event.code to see the physical key being actuated during composition.

Key Features of JavaScript KeyCode Inspector

Full DOM Level 3 Event Coverage

Displays modern standard event.key and event.code alongside legacy keyCode and which integers.

Modifier Key Badges

Real-time active indicators for Ctrl, Shift, Alt/Option, and Meta (Command/Windows) keys.

Physical Location Mapping

Differentiates between Standard, Left, Right, and Numpad instances of keys like Shift, Ctrl, and Enter.

10-Event Historical Stream

Keep track of sequential key combos and keystroke order with precise timestamp logs.

Frequently Asked Questions

Clear answers about using this tool and automating workflows with RunMacro.

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

event.key represents the character or semantic value produced by the key press (taking into account Shift or keyboard layout modifications, such as 'a' vs 'A'), while event.code represents the physical position of the key on the keyboard hardware (such as 'KeyA'), which remains constant regardless of layout.

Why is event.keyCode deprecated in modern web standards?

event.keyCode and event.which are deprecated in the W3C DOM Level 3 specification because they rely on numeric ASCII-like codes that behave inconsistently across international keyboard layouts (AZERTY, QWERTZ, Dvorak) and mobile virtual keyboards. Developers should use event.key or event.code instead.

Does this inspector capture Function keys (F1–F12) and Space?

Yes. This inspector captures all standard keys including Function keys (F1 through F12), Escape, Backspace, Tab, Space, Enter, and arrow navigation keys with minimal lag.

How does RunMacro Macro Recorder use key codes?

RunMacro Macro Recorder uses hardware scan codes (matching event.code) to bind global hotkeys and automate desktop keystroke execution reliably across different software environments and languages.

Related Free Tools

Explore other helpful browser-based utilities in the same category.