Skip to content

Instantly share code, notes, and snippets.

@michaelbartnett
Last active September 24, 2018 01:41
Show Gist options
  • Save michaelbartnett/8245f34e26da7c0bf2d134d2fb524ca7 to your computer and use it in GitHub Desktop.
Save michaelbartnett/8245f34e26da7c0bf2d134d2fb524ca7 to your computer and use it in GitHub Desktop.
hid usage key codes table cleaned up
dec hex name typical AT-101position Mac HIToolbox/Events.h Constant
0 0 Reserved (no event indicated) N/A
1 1 Keyboard ErrorRollOver N/A
2 2 Keyboard POSTFail N/A
3 3 Keyboard ErrorUndefined N/A
4 4 Keyboard a and A 31 kVK_ANSI_A
5 5 Keyboard b and B 50 kVK_ANSI_B
6 6 Keyboard c and C 48 kVK_ANSI_C
7 7 Keyboard d and D 33 kVK_ANSI_D
8 8 Keyboard e and E 19 kVK_ANSI_E
9 9 Keyboard f and F 34 kVK_ANSI_F
10 0A Keyboard g and G 35 kVK_ANSI_G
11 0B Keyboard h and H 36 kVK_ANSI_H
12 0C Keyboard i and I 24 kVK_ANSI_I
13 0D Keyboard j and J 37 kVK_ANSI_J
14 0E Keyboard k and K 38 kVK_ANSI_K
15 0F Keyboard l and L 39 kVK_ANSI_L
16 10 Keyboard m and M 52 kVK_ANSI_M
17 11 Keyboard n and N 51 kVK_ANSI_N
18 12 Keyboard o and O 25 kVK_ANSI_O
19 13 Keyboard p and P 26 kVK_ANSI_P
20 14 Keyboard q and Q 17 kVK_ANSI_Q
21 15 Keyboard r and R 20 kVK_ANSI_R
22 16 Keyboard s and S 32 kVK_ANSI_S
23 17 Keyboard t and T 21 kVK_ANSI_T
24 18 Keyboard u and U 23 kVK_ANSI_U
25 19 Keyboard v and V 49 kVK_ANSI_V
26 1A Keyboard w and W 18 kVK_ANSI_W
27 1B Keyboard x and X 47 kVK_ANSI_X
28 1C Keyboard y and Y 22 kVK_ANSI_Y
29 1D Keyboard z and Z 46 kVK_ANSI_Z
30 1E Keyboard 1 and ! 2 kVK_ANSI_1
31 1F Keyboard 2 and @ 3 kVK_ANSI_2
32 20 Keyboard 3 and # 4 kVK_ANSI_3
33 21 Keyboard 4 and $ 5 kVK_ANSI_4
34 22 Keyboard 5 and % 6 kVK_ANSI_5
35 23 Keyboard 6 and ^ 7 kVK_ANSI_6
36 24 Keyboard 7 and & 8 kVK_ANSI_7
37 25 Keyboard 8 and * 9 kVK_ANSI_8
38 26 Keyboard 9 and ( 10 kVK_ANSI_9
39 27 Keyboard 0 and ) 11 kVK_ANSI_0
40 28 Keyboard Return (ENTER) 43 kVK_Return
41 29 Keyboard ESCAPE 110 kVK_Escape
42 2A Keyboard DELETE (Backspace) 15 kVK_Delete
43 2B Keyboard Tab 16 kVK_Tab
44 2C Keyboard Spacebar 61 kVK_Space
45 2D Keyboard - and (underscore) 12 kVK_ANSI_Minus
46 2E Keyboard = and + 13 kVK_ANSI_Equal
47 2F Keyboard [ and { 27 kVK_ANSI_LeftBracket
48 30 Keyboard ] and } 28 kVK_ANSI_RightBracket
49 31 Keyboard \ and | 29 kVK_ANSI_Backslash
50 32 Keyboard Non-US # and ~ 42
51 33 Keyboard ; and : 40 kVK_ANSI_Semicolon
52 34 Keyboard ' and " 41 kVK_ANSI_Quote
53 35 Keyboard Grave Accent and Tilde 1 kVK_ANSI_Grave
54 36 Keyboard and < 53 kVK_ANSI_Comma
55 37 Keyboard . and > 54 kVK_ANSI_Period
56 38 Keyboard / and ? 55 kVK_ANSI_Slash
57 39 Keyboard Caps Lock 30 kVK_CapsLock
58 3A Keyboard F1 20 kVK_F1
59 3B Keyboard F2 113 kVK_F2
60 3C Keyboard F3 114 kVK_F3
61 3D Keyboard F4 115 kVK_F4
62 3E Keyboard F5 116 kVK_F5
63 3F Keyboard F6 117 kVK_F6
64 40 Keyboard F7 118 kVK_F7
65 41 Keyboard F8 119 kVK_F8
66 42 Keyboard F9 120 kVK_F9
67 43 Keyboard F10 121 kVK_F10
68 44 Keyboard F11 122 kVK_F11
69 45 Keyboard F12 123 kVK_F12
70 46 Keyboard PrintScreen 124
71 47 Keyboard Scroll Lock 125
72 48 Keyboard Pause 126
73 49 Keyboard Insert 75
74 4A Keyboard Home 80 kVK_Home
75 4B Keyboard PageUp 85 kVK_PageUp
76 4C Keyboard Delete Forward 76 kVK_ForwardDelete
77 4D Keyboard End 81 kVK_End
78 4E Keyboard PageDown 86 kVK_PageDown
79 4F Keyboard RightArrow 89 kVK_RightArrow
80 50 Keyboard LeftArrow 79 kVK_LeftArrow
81 51 Keyboard DownArrow 84 kVK_DownArrow
82 52 Keyboard UpArrow 83 kVK_UpArrow
83 53 Keypad Num Lock and Clear 90 kVK_ANSI_KeypadClear
84 54 Keypad / 95 kVK_ANSI_KeypadDivide
85 55 Keypad * 100 kVK_ANSI_KeypadMultiply
86 56 Keypad - 105 kVK_ANSI_KeypadMinus
87 57 Keypad + 106 kVK_ANSI_KeypadPlus
88 58 Keypad ENTER 108 kVK_ANSI_KeypadEnter
89 59 Keypad 1 and End 93 kVK_ANSI_Keypad1
90 5A Keypad 2 and Down Arrow 98 kVK_ANSI_Keypad2
91 5B Keypad 3 and PageDn 103 kVK_ANSI_Keypad3
92 5C Keypad 4 and Left Arrow 92 kVK_ANSI_Keypad4
93 5D Keypad 5 97 kVK_ANSI_Keypad5
94 5E Keypad 6 and Right Arrow 102 kVK_ANSI_Keypad6
95 5F Keypad 7 and Home 91 kVK_ANSI_Keypad7
96 60 Keypad 8 and Up Arrow 96 kVK_ANSI_Keypad8
97 61 Keypad 9 and PageUp 101 kVK_ANSI_Keypad9
98 62 Keypad 0 and Insert 99 kVK_ANSI_Keypad0
99 63 Keypad . and Delete 104 kVK_ANSI_KeypadDecimal
100 64 Keyboard Non-US \ and | 45
101 65 Keyboard Application 129
102 66 Keyboard Power
103 67 Keypad = kVK_ANSI_KeypadEquals
104 68 Keyboard F13 kVK_F13
105 69 Keyboard F14 kVK_F14
106 6a Keyboard F15 kVK_F15
107 6b Keyboard F16 kVK_F16
108 6c Keyboard F17 kVK_F17
109 6d Keyboard F18 kVK_F18
110 6e Keyboard F19 kVK_F19
111 6f Keyboard F20 kVK_F20
112 70 Keyboard F21
113 71 Keyboard F22
114 72 Keyboard F23
115 73 Keyboard F24
116 74 Keyboard Execute
117 75 Keyboard Help kVK_Help
118 76 Keyboard Menu
119 77 Keyboard Select
120 78 Keyboard Stop
121 79 Keyboard Again
122 7a Keyboard Undo
123 7b Keyboard Cut
124 7c Keyboard Copy
125 7d Keyboard Paste
126 7e Keyboard Find
127 7f Keyboard Mute kVK_Mute
128 80 Keyboard Volume Up kVK_VolumeUp
129 81 Keyboard Volume Down kVK_VolumeDown
130 82 Keyboard Locking Caps Lock
131 83 Keyboard Locking Num Lock
132 84 Keyboard Locking Scroll Lock
133 85 Keypad Comma 107
134 86 Keypad Equal Sign
135 87 Keyboard International1 56
136 88 Keyboard International2
137 89 Keyboard International3
138 8A Keyboard International4
139 8B Keyboard International5
140 8C Keyboard International6
141 8D Keyboard International7
142 8E Keyboard International8
143 8F Keyboard International9
144 90 Keyboard LANG1
145 91 Keyboard LANG2
146 92 Keyboard LANG3
147 93 Keyboard LANG4
148 94 Keyboard LANG5
149 95 Keyboard LANG6
150 96 Keyboard LANG7
151 97 Keyboard LANG8
152 98 Keyboard LANG9
153 99 Keyboard Alternate Erase
154 9A Keyboard SysReq/Attention
155 9B Keyboard Cancel
156 9C Keyboard Clear
157 9D Keyboard Prior
158 9E Keyboard Return
159 9F Keyboard Separator
160 A0 Keyboard Out
161 A1 Keyboard Oper
162 A2 Keyboard Clear/Again
163 A3 Keyboard CrSel/Props
164 A4 Keyboard ExSel
165 A5 Reserved
166 A6 Reserved
167 A7 Reserved
168 A8 Reserved
169 A9 Reserved
170 AA Reserved
171 AB Reserved
172 AC Reserved
173 AD Reserved
174 AE Reserved
175 AF Reserved
176 B0 Keypad 00
177 B1 Keypad 000
178 B2 Thousands Separator
179 B3 Decimal Separator
180 B4 Currency Unit
181 B5 Currency Sub-unit
182 B6 Keypad (
183 B7 Keypad )
184 B8 Keypad {
185 B9 Keypad }
186 BA Keypad Tab
187 BB Keypad Backspace
188 BC Keypad A
189 BD Keypad B
190 BE Keypad C
191 BF Keypad D
192 C0 Keypad E
193 C1 Keypad F
194 C2 Keypad XOR
195 C3 Keypad ^
196 C4 Keypad %
197 C5 Keypad <
198 C6 Keypad >
199 C7 Keypad &
200 C8 Keypad &&
201 C9 Keypad |
202 CA Keypad ||
203 CB Keypad :
204 CC Keypad #
205 CD Keypad Space
206 CE Keypad @
207 CF Keypad !
208 D0 Keypad Memory Store
209 D1 Keypad Memory Recall
210 D2 Keypad Memory Clear
211 D3 Keypad Memory Add
212 D4 Keypad Memory Subtract
213 D5 Keypad Memory Multiply
214 D6 Keypad Memory Divide
215 D7 Keypad +/-
216 D8 Keypad Clear
217 D9 Keypad Clear Entry
218 DA Keypad Binary
219 DB Keypad Octal
220 DC Keypad Decimal
221 DD Keypad Hexadecimal
222 DE Reserved
223 DF Reserved
224 E0 Keyboard LeftControl 58 kVK_Control
225 E1 Keyboard LeftShift 44 kVK_Shift
226 E2 Keyboard LeftAlt 60 kVK_Option
227 E3 Keyboard Left GUI 127 kVK_Command
228 E4 Keyboard RightControl 64 kVK_RightControl
229 E5 Keyboard RightShift 57 kVK_RightShift
230 E6 Keyboard RightAlt 62 kVK_RightOption
231 E7 Keyboard Right GUI 128 kVK_RightCommand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment