Skip to content
HZBench
All articles

Hardware analysis

Keyboard rollover and ghosting: 6KRO, NKRO and what a browser can actually see

The USB boot keyboard report has room for six keys, which is where 6-key rollover comes from. A browser test shows which keys arrive; the system can still hide some.

By HZBench editorial teamPublished:

Rollover is the number of keys a keyboard can register at the same time. Press more than that and some keys are dropped. Ghosting is a different fault: a key you did not press appears, usually because of how the key matrix is wired. Most modern keyboards prevent ghosting by blocking extra keys instead, which shows up as missing keys.

Where the number six comes from

The USB HID specification defines a simple boot keyboard input report of 8 bytes: one byte for modifier keys, one reserved byte and six bytes for key codes [1]. A keyboard using that report can describe at most six ordinary keys at once, plus the modifiers. That is the origin of the term 6-key rollover (6KRO).

ByteBoot keyboard report [1]
0Modifier keys (Ctrl, Shift, Alt, GUI)
1Reserved
2–7Key codes 1 to 6

Note that modifiers have their own byte [1]. Shift, Ctrl and Alt held with six other keys still fit in the boot report, so a combination such as W, A, D, Space, R, E plus Shift and Ctrl is within 6KRO. A seventh ordinary key is not.

Keyboards advertised as n-key rollover (NKRO) use other report formats to describe more keys. Whether all of them reach an application depends on the keyboard's mode, the connection and the operating system.

What a browser sees

Browsers report each key with KeyboardEvent.code, which identifies the physical key regardless of the keyboard layout or modifier state [2]. A test can therefore list exactly which keys are held and when each was pressed and released. It cannot see keys the system or browser handles first: system shortcuts, some media keys and the Fn key usually never reach a web page.

How to test

  1. Use a physical keyboard; on-screen keyboards do not report held keys reliably.
  2. Hold the keys you use together in games, for example W, A, D, Shift and Space, and watch the held-keys list.
  3. Add keys one at a time. The first key that does not appear marks your limit for that combination.
  4. Try a different combination: many laptop keyboards block particular groups of three or four keys while allowing others.

Key timing tells you more than rollover

The event log shows the time between key events. Two key-down events for the same key a few milliseconds apart, without a key-up you meant to make, usually point to switch chatter: a worn or dirty switch registering one press twice. That shows up in the log long before it becomes obvious in typing.

A missing key in a browser test is a reason to repeat it in another combination or program, not proof of a fault.

Sources

  1. [1] Device Class Definition for Human Interface Devices (HID), Version 1.11, Appendix B: Boot Interface Descriptors, USB Implementers Forum (accessed )
  2. [2] KeyboardEvent: code property, MDN Web Docs (accessed )

Corrections

How we write and correct articlesReport an error