ContentsVirtual Key Codes
Virtual key codes provide a hardware- and language-independent method of identifying keyboard keys. The following table contains the list of key codes that you can use to identify what key was pressed in an On Key event:
Note: These values are based on the US standard keyboard and may vary by keyboard or country/region. For a full list, see the MSDN documentation.
Decimal |
Hex |
Character |
8 |
8 |
Backspace |
9 |
9 |
Tab |
13 |
D |
Enter |
16 |
10 |
Shift (both) |
17 |
11 |
Ctrl (both) |
18 |
12 |
Alt (both) |
19 |
13 |
Pause |
20 |
14 |
Caps Lock |
27 |
1B |
Esc |
32 |
20 |
Spacebar |
33 |
21 |
Page Up |
34 |
22 |
Page Down |
35 |
23 |
End |
36 |
24 |
Home |
37 |
25 |
(left arrow) |
38 |
26 |
(up arrow) |
39 |
27 |
(right arrow) |
40 |
28 |
(down arrow) |
45 |
2D |
Insert |
46 |
2E |
Delete |
48 |
30 |
0 |
49 |
31 |
1 |
50 |
32 |
2 |
51 |
33 |
3 |
52 |
34 |
4 |
53 |
35 |
5 |
54 |
36 |
6 |
55 |
37 |
7 |
56 |
38 |
8 |
57 |
39 |
9 |
65 |
41 |
A or a |
66 |
42 |
B or b |
67 |
43 |
C or c |
68 |
44 |
D or d |
69 |
45 |
E or e |
70 |
46 |
F or f |
71 |
47 |
G or g |
72 |
48 |
H or h |
73 |
49 |
I or i |
74 |
4A |
J or j |
75 |
4B |
K or k |
76 |
4C |
L or l |
77 |
4D |
M or m |
78 |
4E |
N or n |
79 |
4F |
O or o |
80 |
50 |
P or p |
81 |
51 |
Q or q |
82 |
52 |
R or r |
83 |
53 |
S or s |
84 |
54 |
T or t |
85 |
55 |
U or u |
86 |
56 |
V or v |
87 |
57 |
W or w |
88 |
58 |
X or x |
89 |
59 |
Y or y |
90 |
5A |
Z or z |
91 |
5B |
(left Windows key) |
92 |
5C |
(right Windows key) |
93 |
5D |
(application key - located between |
96 |
60 |
0 (numpad with Num Lock on) |
97 |
61 |
1 (numpad with Num Lock on) |
98 |
62 |
2 (numpad with Num Lock on) |
99 |
63 |
3 (numpad with Num Lock on) |
100 |
64 |
4 (numpad with Num Lock on) |
101 |
65 |
5 (numpad with Num Lock on) |
102 |
66 |
6 (numpad with Num Lock on) |
103 |
67 |
7 (numpad with Num Lock on) |
104 |
68 |
8 (numpad with Num Lock on) |
105 |
69 |
9 (numpad with Num Lock on) |
106 |
6A |
* (numpad) |
107 |
6B |
+ (numpad) |
109 |
6D |
- (numpad) |
110 |
6E |
. (numpad) |
111 |
6F |
/ (numpad) |
112 |
70 |
F1 |
113 |
71 |
F2 |
114 |
72 |
F3 |
115 |
73 |
F4 |
116 |
74 |
F5 |
117 |
75 |
F6 |
118 |
76 |
F7 |
119 |
77 |
F8 |
120 |
78 |
F9 |
121 |
79 |
F10 |
122 |
7A |
F11 |
123 |
7B |
F12 |
144 |
90 |
Num Lock |
145 |
91 |
Scroll Lock |
186 |
BA |
; |
187 |
BB |
= |
188 |
BC |
, |
189 |
BD |
- |
190 |
BE |
. |
191 |
BF |
/ |
192 |
C0 |
` |
219 |
DB |
[ |
220 |
DC |
\ |
221 |
DD |
] |
222 |
DE |
' |