JavaScript Key Codes

While writing JavaScript we often handle the keyboard events like keypress, keyup, etc and implement a specific functionality on a specific key press. For your easy reference, here is a complete list of keyboard keys and their equivalent JavaScript key codes

Keyboard Key JavaScript Key Code
Backspace 8
Tab 9
Enter 13
Shift 16
Crl 17
Alt 18
Pause/Break 19
Caps Lock 20
Escape 27
Page Up 33
Page Down 34
End 35
Home 36
Left Arrow 37
Up Arrow 38
Right Arrow 39
Down Arrow 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 Window Key 91
Right window Key 92
Select Key 93
Number Pad 0 96
Number Pad 1 97
Number Pad 2 98
Number Pad 3 99
Number Pad 4 100
Number Pad 5 101
Number Pad 6 102
Number Pad 7 103
Number Pad 8 104
Number Pad 9 105
Multiply 106
Add 107
Subtract 109
Decimal Point 110
Divide 111
f1 112
f2 113
f3 114
f4 115
f5 116
f6 117
f7 118
f8 119
f9 120
f10 121
f11 122
f12 123
Number Lock 144
Scroll Lock 145
Semi Colon 186
Equals 187
Comma 188
Dash 189
Period 190
Forward Slash 191
Grave Accent 192
Open Bracket 219
Back Slash 220
Close Bracket 221
Single Quote 222

Leave a Comment

Your email address will not be published. Required fields are marked *