Key Codes and Scan Codes Table
(For more details on key codes and scan codes, see the Key Codes and Scan
Codes Explanation.)
The following table lists all of the keys on the 101-key "enhanced" U.S.
keyboard. Many non-U.S. keyboards are similar, but will not be exactly
the same. The keys are arranged roughly in scan code order, which is
generally left to right, moving from the top of the keyboard to the
bottom.
Column 1 shows the key's keycap symbol or name. Columns 2 and 3 show the
scan code, and the ASCII code if the key is unshifted. Columns 4 and 5
contain the codes for the shifted key. Columns 6 and 7 show the codes for
Ctrl plus the key. The last column contains the scan code for Alt plus
the key (Alt keystrokes have no ASCII code and always generate an ASCII
code of 0, which is not shown).
Key names prefaced by np are on the numeric keypad. Those prefaced by cp
are on the cursor keypad between the main typing keys and the number
keypad. The numeric keypad values are valid if Num Lock is turned off.
If you need to specify a number key from the numeric keypad when Num Lock
is on, use the scan code shown for the keypad and the ASCII code shown for
the corresponding typewriter key. For example, the keypad "7" has a scan
code of 71 (the np Home scan code) and an ASCII code of 54 (the ASCII code
for "7").
The chart is blank for key combinations that do not have scan codes or
ASCII codes, like Ctrl-1 or Alt-PgUp.
Top Two Keyboard Rows
Shift Shift Ctrl Ctrl Alt
Scan ASCII Scan ASCII Scan ASCII Scan
Key Code Code Code Code Code Code Code
Esc 1 27 1 27 1 27 1
1 ! 2 49 2 33 120
2 @ 3 50 3 64 3 0 121
3 # 4 51 4 35 122
4 $ 5 52 5 36 123
5 % 6 53 6 37 124
6 ^ 7 54 7 94 7 30 125
7 & 8 55 8 38 126
8 * 9 56 9 42 127
9 ( 10 57 10 40 128
0 ) 11 48 11 41 129
- _ 12 45 12 95 12 31 130
= + 13 61 13 43 131
Backspace 14 8 14 8 14 127 14
Tab 15 9 15 0 148 0 165
Q 16 113 16 81 16 17 16
W 17 119 17 87 17 23 17
E 18 101 18 69 18 5 18
R 19 114 19 82 19 18 19
T 20 116 20 84 20 20 20
Y 21 121 21 89 21 25 21
U 22 117 22 85 22 21 22
I 23 105 23 73 23 9 23
O 24 111 24 79 24 15 24
P 25 112 25 80 25 16 25
[ { 26 91 26 123 26 27 26
] } 27 93 27 125 27 29 27
Enter 28 13 28 13 28 10 28
Bottom Two Keyboard Rows
Shift Shift Ctrl Ctrl Alt
Scan ASCII Scan ASCII Scan ASCII Scan
Key Code Code Code Code Code Code Code
A 30 97 30 65 30 1 30
S 31 115 31 83 31 19 31
D 32 100 32 68 32 4 32
F 33 102 33 70 33 6 33
G 34 103 34 71 34 7 34
H 35 104 35 72 35 8 35
J 36 106 36 74 36 10 36
K 37 107 37 75 37 11 37
L 38 108 38 76 38 12 38
; : 39 59 39 58 39
' " 40 39 40 34 40
` ˜ 41 96 41 126 41
\ | 43 92 43 124 43 28 43
Z 44 122 44 90 44 26 44
X 45 120 45 88 45 24 45
C 46 99 46 67 46 3 46
V 47 118 47 86 47 22 47
B 48 98 48 66 48 2 48
N 49 110 49 78 49 14 49
M 50 109 50 77 50 13 50
, < 51 44 51 60 51
. > 52 46 52 62 52
/ ? 53 47 53 63 53
Space 57 32 57 32 57 32 57
Key Pads and Function Keys
Shift Shift Ctrl Ctrl Alt
Scan ASCII Scan ASCII Scan ASCII Scan
Key Code Code Code Code Code Code Code
F1 59 0 84 0 94 0 104
F2 60 0 85 0 95 0 105
F3 61 0 86 0 96 0 106
F4 62 0 87 0 97 0 107
F5 63 0 88 0 98 0 108
F6 64 0 89 0 99 0 109
F7 65 0 90 0 100 0 110
F8 66 0 91 0 101 0 111
F9 67 0 92 0 102 0 112
F10 68 0 93 0 103 0 113
F11 133 0 135 0 137 0 139
F12 134 0 136 0 138 0 140
np * 55 42 55 42 150 0 55
np Home 71 0 71 55 119 0
cp Home 71 224 71 224 119 224 151
np Up 72 0 72 56 141 0
cp Up 72 224 72 224 141 224 152
np PgUp 73 0 73 57 132 0
cp PgUp 73 224 73 224 132 224 153
np Minus 74 45 74 45 142 0 74
np Left 75 0 75 52 115 0
cp Left 75 224 75 224 115 224 155
np 5 76 0 76 53 143 0
np Right 77 0 77 54 116 0
cp Right 77 224 77 224 116 224 157
np Plus 78 43 78 43 144 0 78
np End 79 0 79 49 117 0
cp End 79 224 79 224 117 224 159
np Down 80 0 80 50 145 0
cp Down 80 224 80 224 145 224 160
np PgDn 81 0 81 51 118 0
cp PgDn 81 224 81 224 118 224 161
np Ins 82 0 82 48 146 0
cp Ins 82 224 82 224 146 224 162
np Del 83 0 83 46 147 0
cp Del 83 224 83 224 147 224 163
np / 224 47 224 47 149 0 164
np Enter 224 13 224 13 224 10 166
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs