Keyboard Scancodes

This page covers keyboard scancodes, typically hexadecimal codes that are transmitted from the keyboard to host via their carrier protocol to indicate what keys the user is pressing. Note that protocol (the specifics of the connection) and scancodes (the data transmitted via that connection) are distinct parts of how a keyboard communicates. This topic is organised by the scancode set itself as major sections with subsections for individual implementations and notes on any idiosyncrasies or nuances.

Note

The keyboard diagrams used throughout this page are best viewed on desktop and presently requires JavaScript to be enabled to work.

Contents

Full list

IBM 5251/5252 scancodes

These scancodes (no official name known) were believed to be introduced in 1977 with the IBM 5251 Display Station and 5252 Dual Display Station keyboards and reused by some later terminals and computers. Only some keys transmit make and break codes and the keyboard's typematic capability varies between implementation. These scancodes were typically transmitted via a specific parallel-based interface.

IBM 5251/5252 Typewriter Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM System/23 Datamaster Keyboard (5322 & 5324)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 5291/5292 Typewriter Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 3290-1/5085 scancodes

These scancodes (no official name known) were believed to be introduced in 1983 with the IBM 3290 Model 1 Information Panel and reused with the IBM 5080 Graphics System's 5085 Graphics Processor. They were the scancodes used by the original design of the IBM Converged Keyboard - Type 1 104-key Model Fs. These scancodes were typically transmitted via a specific parallel-based interface.

IBM 104-key Converged Keyboard (3290-1/5085)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 24-key Numeric or Program Function Keypad (3290-1/5085)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 4704 scancodes

These scancodes (no official name known) are believed to be exclusive to the IBM 4704 Display Station for the IBM 4700 Finance Communication System. These scancodes were transmitted via a specific serial-based interface.

IBM 4704 Model 100 Function Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 4704 Model 200 Alphameric Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 4704 Model 300 Expanded Alphameric Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 4704 Model 400 Administrative Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 4704 102-key Chinese/Japanese Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM scancode set 1

IBM scancode set 1 (sometimes called "XT" scancodes) was the first of the main 3 numbered scancode sets introduced by IBM in the 1980s. They were introduced with the IBM 5150 Personal Computer and also reused by IBM 5155 Portable Personal Computer and 5160 Personal Computer XT. These scancodes were typically transmitted via the serial-based IBM PC Mode 1 protocol (at least for the non-cordless keyboards that used set 1). The "Enhanced" variant of the IBM PC Mode 2 protocol can be instructed to transmit set 1, but this would only allow the keyboard to work with software that expects set 1 input, and not for computers that expect an IBM PC Mode 1 compatible keyboard.

A typical make or break code is a 1-byte hexadecimal value. For keys unique to the IBM Enhanced Keyboard over the IBM Personal Computer AT Keyboard, 2 bytes of values may be sent instead, with the first one being E0. If present, the Pause key uniquely sends 6 bytes of values as its make event and never sends a break code. A given break code is 1 or 2 bytes of values depending on whether E0 is present, and the break code will be the make code plus 0x80. For example:

IBM Personal Computer Keyboard (5150, 5155 & 5160)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM PCjr Cordless Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM JX Cordless Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM Enhanced Keyboard (Personal Systems)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM PS/2 Host Connected Keyboard (Personal Systems)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM scancode set 2

IBM scancode set 2 (sometimes called "AT" scancodes) was chronologically the last of the three numbered scancode sets introduced by IBM in the 1980s. It was introduced in 1984 with the IBM 5170 Personal Computer AT and its Model F keyboard, which means despite being a lower number, IBM scancode set 3 actually predates it by several months. Sets 2 and 3 are also very similar in that they (at least) share alphabet, number row, core numeric keypad, Enter/Return key, Shift key, Tab key and spacebar key codes, but diverge in other areas. These scancodes are transmitted via the "AT" (exclusively) and "Enhanced" (by default) variants of the serial-based IBM PC Mode 2 protocol.

A typical make code is a 1-byte hexadecimal value. For keys unique to the IBM Enhanced Keyboard over the IBM Personal Computer AT Keyboard, 2 bytes of values may be sent instead, with the first one being E0. If present, the Pause key uniquely sends 8 bytes of values with break events integrated into its scancode sequence. A given break code is 2 or 3 bytes of values depending on whether E0 is present, with the first or second byte being F0. For example:

IBM Personal Computer AT Keyboard (5170)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM Enhanced Keyboard (Personal Systems)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM PS/2 Host Connected Keyboard (Personal Systems)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM scancode set 3

IBM scancode set 3 was chronologically the second of the three numbered scancode sets introduced by IBM in the 1980s. It was introduced by 1983 with the IBM 3270 Personal Computer and its 122-key Model F Converged Keyboard, beating the IBM Personal Computer AT Keyboard and IBM scancode set 2 to market. Sets 2 and 3 are very similar in that they (at least) share alphabet, number row, core numeric keypad, Enter/Return key, Shift key, Tab key and spacebar key codes, but diverge in other areas. These scancodes are transmitted via the "terminal" (exclusively) and "Enhanced" (not by default) variants of the serial-based IBM PC Mode 2 protocol, although set 3 is not natively compatible with PC/AT, PS/2 and clone computers that are not compatible with Linux or Windows NT 3.5 and later due to the differences outside the aforementioned similar codes and default make/break behaviour mentioned below.

All make codes are 1-byte hexadecimal values. A given break code is 2 bytes of values, with the first byte being F0. By default, only some keys will send break codes, hence such keys are already maked with F0 on the scancode diagrams below. The versions of the IBM PC Mode 2 protocol that support IBM scancode set 3 will also support system-to-keyboard commands that can alter this behaviour, enabling break codes for all keys or a selection of keys. For example, the spacebar sends 29 as a make code, thus its break code will be F0 29.

Set 1 make/break behaviour

Break codes are always sent except by for Pause keys, and the code used will be the make code plus 0x80. For example:

IBM 122-key Converged Keyboard (3179/3180/319X/3290-2/347X/348X/527X) & PS/2 Host Connected Keyboard (Personal Systems)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM Enhanced Keyboard (3151/316X/319X/347X/348X)

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM scancode set 8Ah

IBM scancode set 8Ah was a unique scancode set used by computers based within the 1983-launched IBM 5550 Multistation series, developed in Japan for domestic use and sometimes exported elsewhere in the Far East. Their IBM 5556 family keyboards Type 1 (5556-001) and Type 2 (5556-002) and variants of both are believed to natively use IBM scancode set 8Ah. IBM based some terminals on the Multistation design including the IBM 3194 Model H50 Display Station (IBM 3270 family) and IBM 5295 Display Station (IBM 5250 family) that also used keyboards derived from 5556 Type 1 and 2. At least some IBM 5576 (Personal System/55) keyboards support IBM scancode set 8Ah on some level, including IBM 5576 family keyboard Type 2 (5576-002). It's unclear if its use is triggered automatically on connection to a compatible host, or that it's something accessed via KDOS only. For 5556, the scancodes are believed to be transmitted via the serial-based 11-bit "AT-style" keyboard interface.

IBM 5556 Type 1 & 2 Multistation 124-key Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

IBM 5576 Type 2 PS/55 106-key Keyboard

Visualisation due to be loaded. If nothing appears, please ensure JavaScript is enabled.

Notes

Further reading & resources

External