General dev

JavaScript Keycode Info

Runs locally

Use JavaScript Keycode Info

What it does

Find out what a key press looks like to JavaScript: the key and code values, the legacy keyCode and which numbers, the key location and the modifiers held down.

It runs entirely in your browser: nothing you enter is uploaded.

Example

Right Shift

Input
Click the box and press the right Shift key.
What the output looks like
event.key: Shift
event.code: ShiftRight
event.keyCode: 16
event.which: 16
event.location: Right (2)
Repeat: No
Shift: Yes

key Shift, code ShiftRight, keyCode 16, location Right (2), and Shift shown as true.

FAQ

Which value should my code use?

Use event.key for the character or key name, which follows the keyboard layout, and event.code for the physical key position, for example for WASD controls. keyCode and which are deprecated and shown only to help with older code.

Why do I see Process, Unidentified or keyCode 229?

During IME composition and with many on-screen mobile keyboards the browser reports key as Process or Unidentified and keyCode 229, so the actual key is unknown. Shortcuts that the browser or operating system handles first, such as Ctrl+W, may never reach the page.

Is anything recorded or sent?

No. Only the last key press is shown, and nothing is stored or uploaded. The box captures every key, including Tab, so click outside it to move on.