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| key | code | ||
|---|---|---|---|
| Modifiers | |||
| Legacy keyCode values for letter and number keys | |||||||
| Key | keyCode | Key | keyCode | Key | keyCode | Key | keyCode |
| A | 65 | J | 74 | S | 83 | 1 | 49 |
| B | 66 | K | 75 | T | 84 | 2 | 50 |
| C | 67 | L | 76 | U | 85 | 3 | 51 |
| D | 68 | M | 77 | V | 86 | 4 | 52 |
| E | 69 | N | 78 | W | 87 | 5 | 53 |
| F | 70 | O | 79 | X | 88 | 6 | 54 |
| G | 71 | P | 80 | Y | 89 | 7 | 55 |
| H | 72 | Q | 81 | Z | 90 | 8 | 56 |
| I | 73 | R | 82 | 0 | 48 | 9 | 57 |
| Legacy keyCode values for numeric keypad keys | Function key values (keyCode) | ||||||
| Key | keyCode | Key | keyCode | Key | keyCode | Key | keyCode |
| 0 | 96 | 8 | 104 | F1 | 112 | F7 | 118 |
| 1 | 97 | 9 | 105 | F2 | 113 | F8 | 119 |
| 2 | 98 | * | 106 | F3 | 114 | F9 | 120 |
| 3 | 99 | + | 107 | F4 | 115 | F10 | 121 |
| 4 | 100 | Enter | 13 | F5 | 116 | F11 | 122 |
| 5 | 101 | - | 109 | F6 | 117 | F12 | 123 |
| 6 | 102 | . | 110 | ||||
| 7 | 103 | / | 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) | |||||||
| Key | keyCode | Key | keyCode | Key | keyCode | Key | keyCode |
| BackSpace | 8 | Esc | 27 | Right Arrow | 39 | -_ | 189 |
| Tab | 9 | Spacebar | 32 | Down Arrow | 40 | .> | 190 |
| Clear | 12 | Page Up | 33 | Insert | 45 | /? | 191 |
| Enter | 13 | Page Down | 34 | Delete | 46 | `~ | 192 |
| Shift | 16 | End | 35 | Num Lock | 144 | [{ | 219 |
| Control | 17 | Home | 36 | ;: | 186 | \| | 220 |
| Alt | 18 | Left Arrow | 37 | =+ | 187 | ]} | 221 |
| Caps Lock | 20 | Up Arrow | 38 | ,< | 188 | '" | 222 |
| Print Screen | 44 | Scroll Lock | 145 | Pause | 19 | Windows / Command | 91 |
| Right Windows / Command | 92 | Context menu | 93 | ||||
| Multimedia key values (keyCode) | |||||||
| Key | keyCode | Key | keyCode | Key | keyCode | Key | keyCode |
| Volume up | 175 | ||||||
| Volume down | 174 | ||||||
| Stop | 179 | ||||||
| Mute | 173 | ||||||
| Browser / Home | 172 | ||||||
| 180 | |||||||
| Search keys | 170 | ||||||
| Collection | 171 | ||||||
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.
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.
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 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.
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.