Look up a JavaScript keyboard key code

Compare a browser keyboard event’s produced key, physical code, and legacy numeric keyCode.

freeworks offlinenothing uploaded
ToolKeyboard Keycode Reference
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The lookup searches a curated US-layout table by key value, physical code, description, or legacy number. UI Events separates the value produced in key from the keyboard position in code, while the numeric keyCode column is retained only to identify older JavaScript.

  • Letter rows use unmodified lowercase US-layout output because Shift, AltGraph, dead keys, and another layout can change the produced value.
  • Leaving search blank displays the full included set rather than listening for a live key event.

Worked example

Enter key
Search for the Enter key
Input
											enter
										
Output
												2 of 110 keys match "enter":

Key    Code         KeyCode  Description                        
Enter  Enter        13       Confirms input or inserts a newline
Enter  NumpadEnter  13       Enter on the numeric keypad        
											

When to use this

Browser shortcuts inspect key, game controls bind code to WASD positions, and legacy front-end maintenance replaces numeric keyCode comparisons with modern event properties.

Edge cases

  • On QWERTZ, the physical KeyY position can produce z; code and key therefore cannot be substituted for each other.
  • Shift+2 can produce @ while its physical code stays Digit2; the static row shows an unmodified example and the live event remains authoritative.
  • Main Enter and keypad Enter both produce Enter but report codes Enter and NumpadEnter, so that search returns two positions.

References