Home / Keyboard / Guides / nkro-rollover-guide

NKRO vs. 6KRO & Ghosting: The Definitive Guide to Keyboard Rollover and Matrix Scanning

Category: Keyboard Architecture Reading Time: 8 min Published: October 2026 Verification: ClackLab Hardware Lab

Every serious gamer and fast typist has encountered marketing slogans boasting NKRO (N-Key Rollover) and 100% Anti-Ghosting. Yet, despite the ubiquity of these terms on retail packaging, few users understand the electrical and protocol engineering that separates a standard keyboard from a true N-Key Rollover device.

Why do inexpensive office keyboards freeze when you press more than three keys simultaneously? Why did the USB specification historically limit keyboards to six simultaneous keys? And how do modern microcontrollers bypass protocol restrictions to deliver infinite simultaneous key recognition?

This comprehensive guide breaks down the physics of keyboard matrix scanning, the phenomenon of sneak paths and ghosting, isolation diode architecture, and the USB Human Interface Device (HID) protocol.


1. How a Keyboard Scans Inputs: The Matrix Circuit

A standard full-sized computer keyboard contains between 104 and 108 keys. If an engineer wired every individual switch directly to the microcontroller unit (MCU), the processor would require over 100 dedicated General Purpose Input/Output (GPIO) pins. This would drastically increase MCU physical packaging size, board manufacturing complexity, and retail cost.

To optimize component count, all modern keyboards organize switches into an electrical grid called a switch matrix, composed of intersecting rows and columns.

            Column 1       Column 2       Column 3
               │              │              │
Row 1 ─────────┼──────[SW1]───┼──────[SW2]───┼──────[SW3]───
               │              │              │
Row 2 ─────────┼──────[SW4]───┼──────[SW5]───┼──────[SW6]───
               │              │              │
Row 3 ─────────┼──────[SW7]───┼──────[SW8]───┼──────[SW9]───

In a typical 104-key layout, the matrix uses approximately 18 columns and 8 rows, requiring only 26 microcontroller pins (18 + 8 = 26).

The Matrix Scanning Cycle

  1. The keyboard MCU holds all row lines at a logic high voltage (e.g., 3.3V or 5V) via internal pull-up resistors.
  2. The MCU drives Column 1 to logic low (0V / Ground) while keeping all other columns high.
  3. The MCU reads the voltage state of all 8 rows simultaneously. If any key on Column 1 is depressed, current flows through the closed switch, pulling that specific row line to logic low (0V).
  4. The MCU records which row went low, maps the row/column intersection to a keycode in firmware, and proceeds to drive Column 2 low, repeating the cycle.
  5. This scan cycle runs continuously at frequencies between 500Hz and 8,000Hz (every 2ms down to 125 microseconds).

2. Ghosting and Blocking: The Geometry of Sneak Paths

While the matrix design is electrically efficient, it introduces a severe physical limitation when multiple switches are closed simultaneously: sneak paths.

What is Ghosting?

Imagine pressing three keys that form three corners of a rectangle in the matrix grid—for example, keys at (Row 1, Col 1), (Row 1, Col 2), and (Row 2, Col 1).

When the MCU strobes Column 2 low: * Switch (Row 1, Col 2) is closed, pulling Row 1 to logic low. * Because Switch (Row 1, Col 1) is also closed, current flows backward through Row 1 into Column 1. * Switch (Row 2, Col 1) is also closed, so current flows through it into Row 2, pulling Row 2 to logic low!

The MCU detects logic low on both Row 1 and Row 2 during Column 2's strobe cycle. As a result, the MCU registers the fourth corner of the rectangle—Switch (Row 2, Col 2)—even though no human ever pressed that key.

This phantom keypress is called ghosting. In a gaming context, ghosting could cause your character to throw an ultimate ability, reload, or switch weapons without your command.

       Col 1          Col 2
Row 1 ──[PRESS]────────[PRESS]──
          │              │  ▲ Sneak current
          │              │  │ flows backwards!
Row 2 ──[PRESS]────────[GHOST]── (Falsely triggered!)

What is Blocking (Jamming)?

To prevent catastrophic ghost inputs, manufacturers of budget keyboards write blocking algorithms into firmware.

When the firmware detects any three keys whose electrical geometry creates an ambiguous rectangular circuit, it intentionally refuses to register the third keypress. Instead of sending an erroneous character, the keyboard simply emits a beep or ignores further input until a key is released.

This behavior is called jamming or key blocking. While it stops ghost inputs, it creates the dreaded experience in gaming where pressing W (walk forward) + Shift (sprint) causes Spacebar (jump) to fail completely.


3. The Hardware Solution: Per-Switch Isolation Diodes

Software tricks cannot solve the physical problem of current flowing backward through closed switches. True anti-ghosting requires a physical electronic gate at every single switch: a semiconductor diode (typically a surface-mount 1N4148 switching diode).

A diode allows electrical current to flow in only one direction (from anode to cathode). By soldering a diode in series with every mechanical switch:

  1. Current can flow from the scanned row through the switch to ground when pressed.
  2. Current is strictly blocked from flowing in reverse up into another row or column line.
  3. Sneak paths are physically impossible. Every single intersection in the matrix is electrically isolated from every other intersection.

With per-switch diodes installed across all 104 keys, the keyboard possesses hardware-level N-Key Rollover. You could press every single key on the keyboard with your forearm, and the microcontroller would resolve every single contact without ambiguity or dropped inputs.


4. The Protocol Bottleneck: USB HID 6KRO vs. NKRO

Having full hardware isolation does not automatically mean your computer receives infinite simultaneous keys. For decades, the barrier to NKRO was not hardware, but the USB Human Interface Device (HID) protocol specification.

The Legacy USB Boot Protocol

When the USB Implementers Forum (USB-IF) developed the initial USB HID specification in the late 1990s, they had to ensure that USB keyboards could function inside bare-metal motherboard BIOS environments before any sophisticated operating system or USB driver loaded.

To achieve this, the USB committee defined the HID Boot Protocol. The standard Boot Protocol keyboard report is strictly fixed at 8 bytes of data:

┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐
│ Byte 0 │ Byte 1 │ Byte 2 │ Byte 3 │ Byte 4 │ Byte 5 │ Byte 6 │ Byte 7 │
├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
│Modifier│Reserved│ Key 1  │ Key 2  │ Key 3  │ Key 4  │ Key 5  │ Key 6  │
│  Mask  │ (0x00) │ Usage  │ Usage  │ Usage  │ Usage  │ Usage  │ Usage  │
└────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘

Because there are only six dedicated payload bytes, a standard boot protocol keyboard can only report six simultaneous alphanumeric keys plus eight modifiers (often marketed as 6KRO). If you hold down A + S + D + F + G + H and press J, the keyboard cannot fit the seventh key into the USB packet.

How Modern Keyboards Achieve True USB NKRO

To overcome the 6KRO limit over modern USB interfaces, keyboard engineers developed three clever architectural solutions:

Method 1: The Multiple Virtual Endpoint (Composite Device) Technique

The keyboard registers itself with the operating system as a USB composite device housing multiple virtual keyboards (e.g., three or four distinct HID collections across multiple endpoints). If you press 18 keys, the keyboard splits the payload into three 6-key packets transmitted back-to-back across separate virtual devices. * Drawback: Certain older KVM switches and BIOS menus fail to recognize composite HID descriptors.

Method 2: Bitmapped Variable-Length HID Report (The Modern Standard)

Instead of sending an array of 6 key usage bytes, the keyboard's HID report descriptor defines a raw bitmap. Each bit in the report corresponds to one specific key code in the USB HID Usage Table (from Usage ID 0x00 through 0x73 or higher). A 16-byte report contains 128 individual bits. If key 0x04 ('A') is pressed, bit 4 is flipped to 1. If key 0x2C ('Space') is pressed, bit 44 is flipped to 1.

Because every key has its own dedicated 1-bit address in the report, all 104+ keys can be reported in a single, compact 16-to-20-byte USB payload. This is the standard method used by open-source firmware (QMK, ZMK) and modern gaming brands.

Method 3: Dynamic Fallback

High-end mechanical boards feature dynamic descriptor switching. When plugged into a UEFI BIOS or legacy motherboard, the board defaults to standard 6KRO Boot Protocol. Once the host OS completes USB enumeration and loads modern HID drivers, the keyboard automatically renegotiates and switches to full bitmap NKRO mode.


5. Rollover Architecture Comparison

Feature Cheap Membrane Keyboard 2-Key / 6-Key Rollover Gaming "Multi-Key Anti-Ghosting" Full NKRO Mechanical
Diodes per Switch None (0 diodes) None or partial Diodes on WASD cluster only Diode on EVERY switch
Matrix Type Flexible conductive trace Rigid or flexible matrix Hybrid matrix Rigid PCB with SMD diodes
Simultaneous Keys 2 to 3 keys max 6 keys + modifiers 6–10 keys around WASD 100+ keys simultaneously
Ghosting Prevention Software blocking Software blocking Partial physical isolation Complete physical isolation
USB Report Type Standard 8-byte HID Standard 8-byte Boot 8-byte Boot or composite 16–24 byte Bitmapped HID

6. How to Test Your Keyboard's Rollover Capabilities

Testing your keyboard for true NKRO versus partial anti-ghosting requires systematic physical checks:

  1. The Classic Phrase Test: Open a blank text document, press and hold down both Left Shift and Right Shift simultaneously, and type the following sentence without letting go of the shifts: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG On a poor 2KRO membrane keyboard, several letters will fail to appear (producing strings like HE QCK BRN FX JMPS VR HE LAZY DG).
  2. The Cluster Rollover Test: In games like rhythm titles (osu!, StepMania) or FPS games, hold down four adjacent keys: W + A + S + D. While holding all four, try pressing Space, R, F, and 1. If any key fails to register, your keyboard lacks full matrix isolation.
  3. Use the Browser Rollover Tool: Visit our ClackLab NKRO Rollover Test. Press your palms flat across your keyboard. The tool listens for simultaneous keydown events across modern browser event APIs. A true NKRO board will light up 20, 30, or 50+ keys simultaneously without dropping a single input.

Summary Checklist for Buyers

Benchmark Your Setup with ClackLab

Want to measure your own hardware latency, detect switch bounce, or test your input speed with microsecond precision?

Launch NKRO Rollover Test →