Read the legacy keyCode of a pressed key

Focus the input before pressing a key. keyCode is deprecated and varies across environments; use modern key or code properties in new event-handling code.

Runs locally in your browser
Show KeyCode values here
key code 
Modifiers 
Legacy keyCode values for letter and number keys
KeykeyCodeKeykeyCodeKeykeyCodeKeykeyCode
A65J74S83149
B66K75T84250
C67L76U85351
D68M77V86452
E69N78W87553
F70O79X88654
G71P80Y89755
H72Q81Z90856
I73R82048957
Legacy keyCode values for numeric keypad keysFunction key values (keyCode)
KeykeyCodeKeykeyCodeKeykeyCodeKeykeyCode
0968104F1112F7118
1979105F2113F8119
298*106F3114F9120
399+107F4115F10121
4100Enter13F5116F11122
5101-109F6117F12123
6102.110
7103/111

Num Lock off: 0→45 Insert · 1→35 End · 2→40 ArrowDown · 3→34 PageDown · 4→37 ArrowLeft · 5→12 Clear · 6→39 ArrowRight · 7→36 Home · 8→38 ArrowUp · 9→33 PageUp · .→46 Delete · Enter→13

Control key values (keyCode)
KeykeyCodeKeykeyCodeKeykeyCodeKeykeyCode
BackSpace8Esc27Right Arrow39-_189
Tab9Spacebar32Down Arrow40.>190
Clear12Page Up33Insert45/?191
Enter13Page Down34Delete46`~192
Shift16End35Num Lock144[{219
Control17Home36;:186\|220
Alt18Left Arrow37=+187]}221
Caps Lock20Up Arrow38,<188'"222
Print Screen44Scroll Lock145Pause19Windows / Command91
Right Windows / Command92Context menu93
Multimedia key values (keyCode)
KeykeyCodeKeykeyCodeKeykeyCodeKeykeyCode
Volume up175
Volume down174
Stop179
Mute173
Browser / Home172
Mail180
Search keys170
Collection171

How to read a key's values

Press a key in the field and the page shows four things about that one press: the key value, the physical code, the legacy keyCode and any modifiers that were held. Values are read by the page itself, so nothing is sent anywhere and the reading works offline.

The four tables below list the legacy keyCode each key reports in current Chrome on Windows. They are a reference for reading old code, not a recommendation: keyCode is deprecated, and event.key and event.code answer most of what keyCode was once used for.

  1. Click the field, then press a single key. The badge fills with the keyCode and the table above it fills with the key value, the code value and the modifiers that were down.
  2. Release everything before the next key, so the modifiers row stays readable. The field empties itself after each press; use Clear if you want to start over.
  3. Check the visible legacy value against the tables below. A key that is not listed still reports a value in the badge.
  4. For old code, compare keyCode with key and code before replacing it, since arrows, punctuation and modifiers are reported differently from each other.

What the tables are, and where the numbers come from

What each value means

key is the character or the name of the key, and it follows your layout and modifiers: the same physical key is a, A or ä depending on Shift and on the keyboard layout. code is the physical position on a standard US layout, so KeyA stays KeyA whichever character it produces. keyCode is the legacy number this page was built around, and the badge shows it next to the other two.

Modifiers are reported separately as Shift, Ctrl, Alt and Meta, and they describe the state at the moment of the press. Pressing Shift by itself reports Shift with keyCode 16 and code ShiftLeft or ShiftRight, so left and right copies of a modifier can be told apart through code even though keyCode does not separate them.

How the tables were checked

Every value in the four tables was compared against real presses in current Chrome on Windows. Letters and digits report their uppercase ASCII value: A is 65 and 0 is 48, with no difference between the shifted and unshifted form. Function keys run 112 to 123. Punctuation reports the unshifted US character, so ; and : both report 186.

Control keys, arrow keys, the function row and the multimedia keys were all verified the same way. The rows for Print Screen, Scroll Lock, Pause, the Windows keys and the context menu key were absent from the older version of this table; they are listed here because they do report keyCodes on Windows.

The numeric keypad depends on Num Lock

The keypad table lists the values a keypad key reports when Num Lock is on: 0 through 9 are 96 to 105, and the operators are * 106, + 107, - 109, . 110 and / 111. With Num Lock off the same physical keys become navigation keys and report the navigation keyCodes instead — 0 becomes Insert, 1 becomes End, 2 becomes ArrowDown, 5 becomes Clear with value 12, and the decimal key becomes Delete.

Two entries collide with the main keyboard in that state: the keypad Enter reports 13 like the main Enter, and the keypad decimal reports 46 like Delete. The code value still separates them, NumpadEnter and NumpadDecimal against Enter and Delete, and that is the reason code is shown next to keyCode rather than instead of it.

What the tool cannot see

A web page only receives what the browser decides to send. Print Screen fires a keydown and usually no keyup, so it appears in the badge and then stays there until the next press. The Fn key on a laptop keyboard, volume and brightness keys that the operating system handles itself, and the Copilot key report nothing at all.

Focus matters as well: the field has to be active for a press to be read, and a key pressed while the window is in the background is never delivered to the page. Please test one key at a time.

Recent tools: