1backspace 8
2tab 9
3enter 13
4shift 16
5ctrl 17
6alt 18
7pause/break 19
8caps lock 20
9escape 27
10page up 33
11Space 32
12page down 34
13end 35
14home 36
15arrow left 37
16arrow up 38
17arrow right 39
18arrow down 40
19print screen 44
20insert 45
21delete 46
220 48
231 49
242 50
253 51
264 52
275 53
286 54
297 55
308 56
319 57
32a 65
33b 66
34c 67
35d 68
36e 69
37f 70
38g 71
39h 72
40i 73
41j 74
42k 75
43l 76
44m 77
45n 78
46o 79
47p 80
48q 81
49r 82
50s 83
51t 84
52u 85
53v 86
54w 87
55x 88
56y 89
57z 90
58left window key 91
59right window key 92
60select key 93
61numpad 0 96
62numpad 1 97
63numpad 2 98
64numpad 3 99
65numpad 4 100
66numpad 5 101
67numpad 6 102
68numpad 7 103
69numpad 8 104
70numpad 9 105
71multiply 106
72add 107
73subtract 109
74decimal point 110
75divide 111
76f1 112
77f2 113
78f3 114
79f4 115
80f5 116
81f6 117
82f7 118
83f8 119
84f9 120
85f10 121
86f11 122
87f12 123
88num lock 144
89scroll lock 145
90My Computer (multimedia keyboard) 182
91My Calculator (multimedia keyboard) 183
92semi-colon 186
93equal sign 187
94comma 188
95dash 189
96period 190
97forward slash 191
98open bracket 219
99back slash 220
100close braket 221
101single quote 222
1Easily check JavaScript KeyboardEvent properties (e.key, e.code, e.which,
2e.keyCode… and more) with Key.js:
3
4https://keyjs.dev
5
6Key Code | Key Description
7----------------------------
80 | Unidentified key
91 |
102 |
113 |
124 |
135 |
146 |
157 |
168 | Backspace
179 | Tab
1810 |
1911 |
2012 | Clear
2113 | Enter
2214 |
2315 |
2416 | Shift
2517 | Control
2618 | Alt
2719 | Pause/Break
2820 | Caps Lock
2921 |
3022 |
3123 |
3224 |
3325 |
3426 |
3527 | Escape
3628 |
3729 |
3830 |
3931 |
4032 | Space Bar
4133 | Page Up
4234 | Page Down
4335 | End
4436 | Home
4537 | Left Arrow
4638 | Up Arrow
4739 | Right Arrow
4840 | Down Arrow
4941 | Select
5042 | Print
5143 | Execute
5244 | Print Screen / Snapshot
5345 | Insert
5446 | Delete
5547 | Help
5648 | 0
5749 | 1
5850 | 2
5951 | 3
6052 | 4
6153 | 5
6254 | 6
6355 | 7
6456 | 8
6557 | 9
6658 |
6759 |
6860 |
6961 |
7062 |
7163 |
7264 |
7365 | A
7466 | B
7567 | C
7668 | D
7769 | E
7870 | F
7971 | G
8072 | H
8173 | I
8274 | J
8375 | K
8476 | L
8577 | M
8678 | N
8779 | O
8880 | P
8981 | Q
9082 | R
9183 | S
9284 | T
9385 | U
9486 | V
9587 | W
9688 | X
9789 | Y
9890 | Z
9991 | Left Window/Meta/OS Key
10092 | Right Window/Meta/OS Key
10193 | Context Menu
10294 |
10395 |
10496 | Numpad 0
10597 | Numpad 1
10698 | Numpad 2
10799 | Numpad 3
108100 | Numpad 4
109101 | Numpad 5
110102 | Numpad 6
111103 | Numpad 7
112104 | Numpad 8
113105 | Numpad 9
114106 | Multiply
115107 | Add
116108 | Keypad Enter
117109 | Subtract
118110 | Decimal Point
119111 | Divide
120112 | F1
121113 | F2
122114 | F3
123115 | F4
124116 | F5
125117 | F6
126118 | F7
127119 | F8
128120 | F9
129121 | F10
130122 | F11
131123 | F12
132124 | F13
133125 | F14
134126 | F15
135127 | F16
136128 | F17
137129 | F18
138130 | F19
139131 | F20
140132 | F21
141133 | F22
142134 | F23
143135 | F24
144136 | F25
145137 | F26
146138 | F27
147139 | F28
148140 | F29
149141 | F30
150142 | F31
151143 | F32
152144 | Num Lock
153145 | Scroll Lock
154146 |
155147 |
156148 |
157149 |
158150 |
159151 |
160152 |
161153 |
162154 |
163155 |
164156 |
165157 |
166158 |
167159 |
168160 |
169161 |
170162 |
171163 |
172164 |
173165 |
174166 | Navigate/Page Back
175167 | Navigate/Page Forward
176168 | Reload/Refresh Page
177169 |
178170 |
179171 |
180172 |
181173 |
182174 | Audio Volume Down
183175 | Audio Volume Up
184176 |
185177 |
186178 |
187179 |
188180 |
189181 |
190182 |
191183 |
192184 |
193185 |
194186 | Semi-colon
195187 | Equal Sign
196188 | Comma
197189 | Dash
198190 | Period
199191 | Forward Slash
200192 | Grave Accent
201193 |
202194 |
203195 |
204196 |
205197 |
206198 |
207199 |
208200 |
209201 |
210202 |
211203 |
212204 |
213205 |
214206 |
215207 |
216208 |
217209 |
218210 |
219211 |
220212 |
221213 |
222214 |
223215 |
224216 |
225217 |
226218 |
227219 | Open Bracket
228220 | Back Slash
229221 | Close Bracket
230222 | Single Quote
231223 |
232224 |
233225 |
234226 |
235227 |
236228 |
237229 |
238230 |
239231 |
240232 |
241233 |
242234 |
243235 |
244236 |
245237 |
246238 |
247239 |
248240 |
249241 |
250242 |
251243 |
252244 |
253245 |
254246 |
255247 |
256248 |
257249 |
258250 |
259251 |
260252 |
261253 |
262254 |
263255 |
1KeyCode = {
2 BACKSPACE: 8,
3 TAB: 9,
4 ENTER: 13,
5 SHIFT: 16,
6 CTRL: 17,
7 ALT: 18,
8 PAUSE: 19,
9 CAPS_LOCK: 20,
10 ESCAPE: 27,
11 SPACE: 32,
12 PAGE_UP: 33,
13 PAGE_DOWN: 34,
14 END: 35,
15 HOME: 36,
16 LEFT_ARROW: 37,
17 UP_ARROW: 38,
18 RIGHT_ARROW: 39,
19 DOWN_ARROW: 40,
20 INSERT: 45,
21 DELETE: 46,
22 KEY_0: 48,
23 KEY_1: 49,
24 KEY_2: 50,
25 KEY_3: 51,
26 KEY_4: 52,
27 KEY_5: 53,
28 KEY_6: 54,
29 KEY_7: 55,
30 KEY_8: 56,
31 KEY_9: 57,
32 KEY_A: 65,
33 KEY_B: 66,
34 KEY_C: 67,
35 KEY_D: 68,
36 KEY_E: 69,
37 KEY_F: 70,
38 KEY_G: 71,
39 KEY_H: 72,
40 KEY_I: 73,
41 KEY_J: 74,
42 KEY_K: 75,
43 KEY_L: 76,
44 KEY_M: 77,
45 KEY_N: 78,
46 KEY_O: 79,
47 KEY_P: 80,
48 KEY_Q: 81,
49 KEY_R: 82,
50 KEY_S: 83,
51 KEY_T: 84,
52 KEY_U: 85,
53 KEY_V: 86,
54 KEY_W: 87,
55 KEY_X: 88,
56 KEY_Y: 89,
57 KEY_Z: 90,
58 LEFT_META: 91,
59 RIGHT_META: 92,
60 SELECT: 93,
61 NUMPAD_0: 96,
62 NUMPAD_1: 97,
63 NUMPAD_2: 98,
64 NUMPAD_3: 99,
65 NUMPAD_4: 100,
66 NUMPAD_5: 101,
67 NUMPAD_6: 102,
68 NUMPAD_7: 103,
69 NUMPAD_8: 104,
70 NUMPAD_9: 105,
71 MULTIPLY: 106,
72 ADD: 107,
73 SUBTRACT: 109,
74 DECIMAL: 110,
75 DIVIDE: 111,
76 F1: 112,
77 F2: 113,
78 F3: 114,
79 F4: 115,
80 F5: 116,
81 F6: 117,
82 F7: 118,
83 F8: 119,
84 F9: 120,
85 F10: 121,
86 F11: 122,
87 F12: 123,
88 NUM_LOCK: 144,
89 SCROLL_LOCK: 145,
90 SEMICOLON: 186,
91 EQUALS: 187,
92 COMMA: 188,
93 DASH: 189,
94 PERIOD: 190,
95 FORWARD_SLASH: 191,
96 GRAVE_ACCENT: 192,
97 OPEN_BRACKET: 219,
98 BACK_SLASH: 220,
99 CLOSE_BRACKET: 221,
100 SINGLE_QUOTE: 222
101 };
102
103Ecample:
104
105if (event.which == KeyCode.TAB) {
106 console.log("Tab was pressed");
107}