Skip to content

Instantly share code, notes, and snippets.

@nberlette
Last active August 30, 2021 08:09
Show Gist options
  • Save nberlette/cbd4b304741b45d703084836c757609b to your computer and use it in GitHub Desktop.
Save nberlette/cbd4b304741b45d703084836c757609b to your computer and use it in GitHub Desktop.
Key Names and Codes

Keyboard Names, Numbers, and Aliases

Key Name Key Code Description / Aliases
A...Z 65~90 and 97~112 See: Letters
0...9 48~57 and 41, 96~105 See: Numbers
F1...F19 112~130 See: Functions
; 186, 59 Semicolon
= 187, 61 Equal
, 188, 44 Comma
- 189, 45, 173, 109 minus, Hyphen, dash
* 106 Asterisk
+ 107 plus
. 190, 110 Period, Decimal, Point
/ 191, 111 Forward Slash
` 192 Back Tick
[ 219 Left Bracket
\ 220 Backslash
] 221 Right Bracket
' 222 quote, Single Quote

Control

Key Name Key Code Description / Aliases
backspace 8
del/delete 46
ins/insert 45
tab 9 ->|
return 13 enter
esc 27 escape
space 32 ________
pageup 33
pagedown 34
end 35
home 36
left 37 <-
up 38
right 39 ->
down 40
shift 16
ctrl 17
alt 18
cap 20 Caps Lock
num 144 Num Lock
clear 12
meta 91 Meta, Win, Window, Cmd, Command

Letters and Numbers

Key Name Key Code Description / Aliases
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 --
1 91 --
2 92 --
3 93 --
4 94 --
5 95 --
6 96 --
7 97 --
8 98 --
9 99 --
0 100 --

Functions

Key Name Key Code
F1 112
F2 113
F3 114
F4 115
F5 116
F6 117
F7 118
F8 119
F9 120
F10 121
F11 122
F12 123
F13 124
F14 125
F15 126
F16 127
F17 128
F18 129

In regards to JavaScript Event Listeners (e or event):

Key Name maps to e.key
Key Code maps to e.keyCode (or e.which)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment