Note:

This reference is primarily for US keyboards. There are many keyboard layouts internationally which include not only different characters, but standard characters in different places. And there can be differences between browsers and browser versions.

Key Code Generator CCBot/2.0 (http://commoncrawl.org/faq/)

Key Code Key Code Key Code
Backspace
8
E
69
NumPad 8
104
Tab
9
F
70
NumPad 9
105
Enter
13
G
71
NumPad *
106
Shift
16
H
72
NumPad +
107
Ctrl
17
I
73
NumPad -
109
Alt
18
J
74
NumPad .
110
Pause/Break
19
K
75
NumPad /
111
Caps Lock
20
L
76
F1
112
Esc
27
M
77
F2
113
Page Up
33
N
78
F3
114
Page Down
34
O
79
F4
115
End
35
P
80
F5
116
Home
36
Q
81
F6
117
37
R
82
F7
118
38
S
83
F8
119
39
T
84
F9
120
40
U
85
F10
121
Insert
45
V
86
F11
122
Delete
46
W
87
F12
123
0
)
48
X
88
Num Lock
144
1
!
49
Y
89
Scroll Lock
145
2
@
50
Z
90
;
:
186
3
#
51
Left WinKey
91
=
+
187
4
$
52
Right WinKey
92
,
<
188
5
%
53
Select
93
-
_
189
6
^
54
NumPad 0
96
.
>
190
7
&
55
NumPad 1
97
/
?
191
8
*
56
NumPad 2
98
`
~
192
9
(
57
NumPad 3
99
[
{
219
A
65
NumPad 4
100
\
|
220
B
66
NumPad 5
101
]
}
221
C
67
NumPad 6
102
'
"
222
D
68
NumPad 7
103   
Code Key Code Key Code Key
8
Backspace
69
E
104
NumPad 8
9
Tab
70
F
105
NumPad 9
13
Enter
71
G
106
NumPad *
16
Shift
72
H
107
NumPad +
17
Ctrl
73
I
109
NumPad -
18
Alt
74
J
110
NumPad .
19
Pause/Break
75
K
111
NumPad /
20
Caps Lock
76
L
112
F1
27
Esc
77
M
113
F2
33
Page Up
78
N
114
F3
34
Page Down
79
O
115
F4
35
End
80
P
116
F5
36
Home
81
Q
117
F6
37
82
R
118
F7
38
83
S
119
F8
39
84
T
120
F9
40
85
U
121
F10
45
Insert
86
V
122
F11
46
Delete
87
W
123
F12
48
0
)
88
X
144
Num Lock
49
1
!
89
Y
145
Scroll Lock
50
2
@
90
Z
186
;
:
51
3
#
91
Left WinKey
187
=
+
52
4
$
92
Right WinKey
188
,
<
53
5
%
93
Select
189
-
_
54
6
^
96
NumPad 0
190
.
>
55
7
&
97
NumPad 1
191
/
?
56
8
*
98
NumPad 2
192
`
~
57
9
(
99
NumPad 3
219
[
{
65
A
100
NumPad 4
220
\
|
66
B
101
NumPad 5
221
]
}
67
C
102
NumPad 6
222
'
"
68
D
103
NumPad 7
  
The following javascript code snippet creates an array of objects containing the key code (id) and the key character (name).
/* Key Code list by http://www.javascriptkeycode.com */
var keycodes = [{"id":8,"name":"Backspace"},{"id":9,"name":"Tab"},{"id":13,"name":"Enter"},{"id":16,"name":"Shift"},{"id":17,"name":"Ctrl"},{"id":18,"name":"Alt"},{"id":19,"name":"Pause/Break"},{"id":20,"name":"Caps Lock"},{"id":27,"name":"Esc"},{"id":33,"name":"Page Up"},{"id":34,"name":"Page Down"},{"id":35,"name":"End"},{"id":36,"name":"Home"},{"id":37,"name":"←"},{"id":38,"name":"↑"},{"id":39,"name":"→"},{"id":40,"name":"↓"},{"id":45,"name":"Insert"},{"id":46,"name":"Delete"},{"id":48,"name":"0"},{"id":49,"name":"1"},{"id":50,"name":"2"},{"id":51,"name":"3"},{"id":52,"name":"4"},{"id":53,"name":"5"},{"id":54,"name":"6"},{"id":55,"name":"7"},{"id":56,"name":"8"},{"id":57,"name":"9"},{"id":65,"name":"A"},{"id":66,"name":"B"},{"id":67,"name":"C"},{"id":68,"name":"D"},{"id":69,"name":"E"},{"id":70,"name":"F"},{"id":71,"name":"G"},{"id":72,"name":"H"},{"id":73,"name":"I"},{"id":74,"name":"J"},{"id":75,"name":"K"},{"id":76,"name":"L"},{"id":77,"name":"M"},{"id":78,"name":"N"},{"id":79,"name":"O"},{"id":80,"name":"P"},{"id":81,"name":"Q"},{"id":82,"name":"R"},{"id":83,"name":"S"},{"id":84,"name":"T"},{"id":85,"name":"U"},{"id":86,"name":"V"},{"id":87,"name":"W"},{"id":88,"name":"X"},{"id":89,"name":"Y"},{"id":90,"name":"Z"},{"id":91,"name":"Left WinKey"},{"id":92,"name":"Right WinKey"},{"id":93,"name":"Select"},{"id":96,"name":"NumPad 0"},{"id":97,"name":"NumPad 1"},{"id":98,"name":"NumPad 2"},{"id":99,"name":"NumPad 3"},{"id":100,"name":"NumPad 4"},{"id":101,"name":"NumPad 5"},{"id":102,"name":"NumPad 6"},{"id":103,"name":"NumPad 7"},{"id":104,"name":"NumPad 8"},{"id":105,"name":"NumPad 9"},{"id":106,"name":"NumPad *"},{"id":107,"name":"NumPad +"},{"id":109,"name":"NumPad -"},{"id":110,"name":"NumPad ."},{"id":111,"name":"NumPad /"},{"id":112,"name":"F1"},{"id":113,"name":"F2"},{"id":114,"name":"F3"},{"id":115,"name":"F4"},{"id":116,"name":"F5"},{"id":117,"name":"F6"},{"id":118,"name":"F7"},{"id":119,"name":"F8"},{"id":120,"name":"F9"},{"id":121,"name":"F10"},{"id":122,"name":"F11"},{"id":123,"name":"F12"},{"id":144,"name":"Num Lock"},{"id":145,"name":"Scroll Lock"},{"id":186,"name":";"},{"id":187,"name":"="},{"id":188,"name":","},{"id":189,"name":"-"},{"id":190,"name":"."},{"id":191,"name":"/"},{"id":192,"name":"`"},{"id":219,"name":"["},{"id":220,"name":"\\"},{"id":221,"name":"]"},{"id":222,"name":"'"}];

A key code is an implementation dependent numerical code identifying the unmodified value of the pressed key. The Javascript keydown, keypress, and keyup events specify which key (key code) was pressed and if any modifiers (shift, alt, ctrl) are pressed at the same time. It's important to note that the key code is a unique code for the key itself and doesn't change if a modifier is pressed. i.e. "!" has the same key code as "1".

Because different keyboards, systems, and implementations can use different values for the different keys, care should be exercised when using key codes.