Minecraft:Key codes
More actions
Template:For This is a list of key codes used by Minecraft:Minecraft, which are used in the Minecraft:options.txt file.
Java Edition
Only keys which can be directly detected by the operating system are able to be bound to game controls - keys such as F Lock<ref>Template:Bug</ref> or Fn typically are not recognisable themselves as keys, and Minecraft and all other computer programs will be oblivious to them in isolation.
Only mouse buttons can have controls be bound to them in the options menu. Mouse movement, vertical scrolling and horizontal scrolling are hardcoded, and their default actions cannot be assigned to other keys or buttons, nor can scrolling or moving the mouse be made to do anything else.
Java Edition does not provide official support for controllers.
Keyboard codes
The displayed names of several keys will change depending on the currently active system keyboard layout. The values displayed in this table assume a standard en-US QWERTY layout. Some keys also have operating system dependent names, which are assigned different rows sharing an ID.
Without names
Template:Main SDL3 maintains its own internal numbering system, meaning that these match from one operating system to the other, unlike what was the case with GLFW.Template:Upcoming
While any number greater than 9 can be placed after Template:Code, only those which can actually be accessed via a key press binding in-game are listed. Many are automatically converted to proper key IDs at runtime.
The keys listed here are mostly comprised of buttons exclusive to Japanese, Korean and Brazilian keyboard layouts, as well as buttons on multimedia keyboards.
Mouse codes
Mouse buttons are handled as a signed 32-bit integer, meaning that through editing options.txt, values from Template:Code to Template:Code can be specified without being rejected by the game as invalid.<ref>Template:Bug</ref> However, the USB HID specification only permits mouse buttons from 1 to 65535,<ref>https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf</ref> meaning that all negative values and the vast majority of the positive values can never actually be assigned to in-game actions without file editing.
Only the first eight mouse buttons can have controls assigned to them.Template:Until
On Linux, mouse buttons up to 48Template:Upcoming can be specified (evdev key press events 272 to 319) - it is not known if any supported operating systems support a 49th or higher mouse button as input. The maximum mouse button on macOS is 32, and the maximum mouse button on Windows is 5.
For the first three mouse buttons, the translation keys match the key IDs; all other buttons follow a generic template.
Bedrock Edition
Keyboard codes
In Template:BE, keys are stored as the value of their virtual key code.
Mouse codes
Template:Info needed section Mouse buttons are represented by negative numbers.
Controller codes
History
Java Edition
Notes
References
Template:Navbox Java Edition technical Template:Navbox Bedrock Edition
Minecraft:fr:Codes de touche Minecraft:hu:Billentyűkódok Minecraft:ja:キーコード Minecraft:nl:Toetscodes Minecraft:pt:Códigos de teclas Minecraft:ru:Коды клавиш Minecraft:uk:Коди клавіш Minecraft:zh:键控代码