Keyboard Keys and Key Code Values

Share:

Press any key to see the Key Code in below Table

Datakeydownkeypresskeyup
keyCode
Shift
Ctrl
Alt

No keyCode values of keydown, keyup events standardized across browsers.
For example : keys = +, - _, PrntScrn  have different key codes in different browsers.
The table below shows the event.keyCode values for keydown and keyup events.

Avoid using this table for character codes of keypress events because keypress character codes are not key specific and are entirely different from keydown and keyup key codes.

Highlighted Rows have difference in key values

Tested on following browser versions:-

Browser Version
Chrome 64
Firefox 59
IE 8
Opera 51
Safari 10

Key Code under each browser
Key Chrome Firefox IE Opera Safari
Backspace 8 8 8 8 8
Tab 9 9 9 9 9
Enter 13 13 13 13 13
Shift 16 16 16 16 16
Ctrl 17 17 17 17 17
Alt 18 18 18 18 18
Pause, Break 19 19 19 19 19
CapsLock 20 20 20 20 20
Esc 27 27 27 27 27
Space 32 32 32 32 32
Page Up 33 33 33 33 33
Page Down 34 34 34 34 34
End 35 35 35 35 35
Home 36 36 36 36 36
Left arrow 37 37 37 37 37
Up arrow 38 38 38 38 38
Right arrow 39 39 39 39 39
Down arrow 40 40 40 40 40
PrtScn 44 44 44 44
Insert 45 45 45 45 45
Delete 46 46 46 46 46
0 48 48 48 48 48
1 49 49 49 49 49
2 50 50 50 50 50
3 51 51 51 51 51
4 52 52 52 52 52
5 53 53 53 53 53
6 54 54 54 54 54
7 55 55 55 55 55
8 56 56 56 56 56
9 57 57 57 57 57
A 65 65 65 65 65
B 66 66 66 66 66
C 67 67 67 67 67
D 68 68 68 68 68
E 69 69 69 69 69
F 70 70 70 70 70
G 71 71 71 71 71
H 72 72 72 72 72
I 73 73 73 73 73
J 74 74 74 74 74
K 75 75 75 75 75
L 76 76 76 76 76
M 77 77 77 77 77
N 78 78 78 78 78
O 79 79 79 79 79
P 80 80 80 80 80
Q 81 81 81 81 81
R 82 82 82 82 82
S 83 83 83 83 83
T 84 84 84 84 84
U 85 85 85 85 85
V 86 86 86 86 86
W 87 87 87 87 87
X 88 88 88 88 88
Y 89 89 89 89 89
Z 90 90 90 90 90
F1 112 112 112 112 112
F2 113 113 113 113 113
F3 114 114 114 114 114
F4 115 115 115 115 115
F5 116 116 116 116 116
F6 117 117 117 117 117
F7 118 118 118 118 118
F8 119 119 119 119 119
F9 120 120 120 120 120
F10 121 121 121 121 121
F11 122 122 122 122 122
F12 123 123 123 123 123
NumLock 144 144 144 144 144
ScrollLock 145 145 145 145 145
, < 188 188 188 188 188
. > 190 190 190 190 190
/ ? 191 191 191 191 191
` ~ 192 192 192 192 192
[ { 219 219 219 219 219
\ | 220 220 220 220 220
] } 221 221 221 221 221
' " 222 222 222 222 222
Mute On/Off 173 173 173 173 173
Volume Down 174 174 174 174 174
Volume Up 175 175 175 175 175
; : 186 186 186 186 186
= + 187 61 187 187 187
- _ 189 173 189 189 189

Hi! I am Sartaj Husain. I am a Professional Software Developer, live in Delhi. I write blogs in my free time. I love to learn and share the knowledge with others because it is no good to try to stop knowledge from going forward. So free posts and tutorials. more..

No comments