Skip to content

Instantly share code, notes, and snippets.

@eegrok
Last active May 7, 2024 13:45
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save eegrok/949034 to your computer and use it in GitHub Desktop.
Save eegrok/949034 to your computer and use it in GitHub Desktop.
Mac virtual keycodes
from: http://www.meandmark.com/keycodes.html
with some additions from people in the comments, thanks :)
Virtual Keycodes for the Mac QWERTY Layout
Keycodes are in hexadecimal. A blank entry means either there is no key assigned to that keycode or I was unable to find the assigned key.
Keycode Key
0x00 A
0x01 S
0x02 D
0x03 F
0x04 H
0x05 G
0x06 Z
0x07 X
0x08 C
0x09 V
0x0A Section (ISO layout)
0x0B B
0x0C Q
0x0D W
0x0E E
0x0F R
0x10 Y
0x11 T
0x12 1
0x13 2
0x14 3
0x15 4
0x16 6
0x17 5
0x18 =
0x19 9
0x1A 7
0x1B -
0x1C 8
0x1D 0
0x1E ]
0x1F O
0x20 U
0x21 [
0x22 I
0x23 P
0x24 Return
0x25 L
0x26 J
0x27 '
0x28 K
0x29 ;
0x2A \
0x2B ,
0x2C /
0x2D N
0x2E M
0x2F .
0x30 Tab
0x31 Space
0x32 ~
0x33 Delete
0x34 Enter (on Powerbook)
0x35 Esc
0x36 Right Cmd
0x37 Cmd (Apple)
0x38 Shift
0x39 Caps Lock
0x3A Option
0x3B Control
0x3C Right Shift
0x3D Right Option
0x3E Right Control
0x3F Fn/Globe
0x40 F17
0x41 Numeric Keypad .
0x42
0x43 Numeric Keypad *
0x44
0x45 Numeric Keypad +
0x46
0x47 Clear (or NumLock)
0x48 Volume Up
0x49 Volume Down
0x4A Mute
0x4B Numeric Keypad /
0x4C Numeric Keypad Enter
0x4D
0x4E Numeric Keypad -
0x4F F18
0x50 F19
0x51 Numeric Keypad =
0x52 Numeric Keypad 0
0x53 Numeric Keypad 1
0x54 Numeric Keypad 2
0x55 Numeric Keypad 3
0x56 Numeric Keypad 4
0x57 Numeric Keypad 5
0x58 Numeric Keypad 6
0x59 Numeric Keypad 7
0x5A F20
0x5B Numeric Keypad 8
0x5C Numeric Keypad 9
0x5D Yen (JIS layout)
0x5E Underscore (JIS layout)
0x5F Keypad Comma/Separator (JIS layout)
0x60 F5
0x61 F6
0x62 F7
0x63 F3
0x64 F8
0x65 F9
0x66 Eisu (JIS layout)
0x67 F11
0x68 Kana (JIS layout)
0x69 F13
0x6A F16
0x6B F14
0x6C
0x6D F10
0x6E Menu (on PC)
0x6F F12
0x70
0x71 F15
0x72 Help
0x73 Home
0x74 Page Up
0x75 Del (Below the Help Key)
0x76 F4
0x77 End
0x78 F2
0x79 Page Down
0x7A F1
0x7B Left Arrow
0x7C Right Arrow
0x7D Down Arrow
0x7E Up Arrow
0x7F Power (on PC)
@usdaproved
Copy link

For anyone reading this, be mindful that 0x70 is missing on this listing, it should be a blank space like all the other gaps in the key codes. I got tripped up for a bit trying to find where I got out of sync in my keycode mappings.

@eegrok
Copy link
Author

eegrok commented Dec 12, 2023

For anyone reading this, be mindful that 0x70 is missing on this listing, it should be a blank space like all the other gaps in the key codes. I got tripped up for a bit trying to find where I got out of sync in my keycode mappings.

I've added that in now

@groverlynn
Copy link

0x0A: Section (ISO layout)
0x34: Enter (on Powerbook)
0x36: Right Cmd
0x3C: Right Shift
0x3D: Right Option
0x3E: Right Control
0x3F: Fn/Globe
0x40: F17
0x47: Clear (or NumLock)
0x48: Volume Up
0x49: Volume Down
0x4A: Mute
0x4F: F18
0x50: F19
0x5A: F20
0x5D: Yen (JIS layout)
0x5E: Underscore (JIS layout)
0x5F: Keypad Comma/Separator (JIS layout)
0x66: Eisu (JIS layout)
0x68: Kana (JIS layout)
0x6A: F16
0x6E: Menu (on PC)
0x7F: Power (on PC)

@eegrok
Copy link
Author

eegrok commented May 1, 2024

0x0A: Section (ISO layout) 0x34: Enter (on Powerbook) 0x36: Right Cmd 0x3C: Right Shift 0x3D: Right Option 0x3E: Right Control 0x3F: Fn/Globe 0x40: F17 0x47: Clear (or NumLock) 0x48: Volume Up 0x49: Volume Down 0x4A: Mute 0x4F: F18 0x50: F19 0x5A: F20 0x5D: Yen (JIS layout) 0x5E: Underscore (JIS layout) 0x5F: Keypad Comma/Separator (JIS layout) 0x66: Eisu (JIS layout) 0x68: Kana (JIS layout) 0x6A: F16 0x6E: Menu (on PC) 0x7F: Power (on PC)

Thanks, added those now

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