JS keycode


Press any key, and its key code will be shown below:

No Key was pressed

event.keycode returns the unicode value of a pressed key in events such as onkeydown(event), onkeyup(event) etc. Following codes are embedded in this page, if you press any key, its key code will be show above.

<body>
<script language="javascript">
function kcode(ev)
{
document.getElementById("kc").innerHTML="" + ev.keyCode + "";
document.getElementById("kc").innerHTML+=String.fromCharCode(ev.keyCode);
}
</script>
<div id="kc">No Key was pressed</div>


List of keycode:

Key
KeyCode
Key
KeyCode
Key
KeyCode
Backspace (\b)
8
Tab (\t)
9
Enter (\n)
13
Shift
16
Ctrl
17
Alt
18
Pause/Break
19
Caps Lock
20
Esc
27
Page Up
33
Page Down
34
End
35
Home
36
Left ←
37
Up ↑
38
Right →
39
Down ↓
40
Insert
45
Delete
46
0 )
48
1 !
49
2 @
50
3 #
51
4 $
52
5 %
53
6 ^
54
7 &
55
8 *
56
9 (
57
A
65
B
66
C
67
D
68
E
69
F
70
G
71
H
72
I
73
J
74
K
75
L
76
M
77
N
78
O
79
P
80
Q
81
R
82
S
83
T
84
U
85
V
86
W
87
X
88
Y
89
Z
90
Left Win
91
Right Win
92
Context Menu
93
F1
112
F2
113
F3
114
F4
115
F5
116
F6
117
F7
118
F8
119
F9
120
F10
121
F11
122
F12
123
Scroll Lock
145
: ;
186*
+ =
187**
, <
188
- _
189
. >
190
? /
191
~ `
192
{ [
219
| \
220
} ]
221
" '
222

*: 59 in firefox
**: 61 in firefox



Extended Numeric Keyboard:

Key
KeyCode
Key
KeyCode
Key
KeyCode
Num Lock
144
/
111
*
106
7 Home
103/36
8 ↑
104/38
9 PgUp
105/33
4 ←
100/37
5
101/12
6 →
102/39
1 End
97/35
2 ↓
98/40
3 PgDn
99/34
0 Ins
96/45
. Del
110/46
-
109
+
107
Enter
13