Keyboard Keys Swapped While Typing: How to Tell Transposition Errors from Scan Code Remaps
Launch Companion Diagnostic Tool
Test your hardware right now in your browser with zero install:
Open Keyboard TesterIf your keyboard is typing wrong letters, the cause is almost always a software-level scan code remap, a stuck modifier key sending ghost signals, or a debounce firmware fault on the PCB, not a hardware swap of the physical switches. The keyboard controller assigns each key a scan code the moment the switch actuates; if that mapping table is corrupted or overwritten by a utility like SharpKeys, Microsoft PowerToys Keyboard Manager, or a vendor macro engine, every keystroke from that key will output the wrong character. On the mechanical side, a switch with a worn Omron D2FC-F-7N contact or a Kailh GM 8.0 with oxidized gold plating can misfire a double-signal that the firmware debounce timer fails to filter, producing transposition artifacts that look identical to a remap fault at the surface level.
Confirm the Problem with a Live Key Output Test
Before touching any settings, verify exactly which keys are producing wrong output and whether the swap is bidirectional. Go to the Keyboard Test tool and press each suspect key one at a time. The tool reads raw key codes directly from the browser event layer, bypassing your text editor's autocorrect and any IME composition buffer. Note the following:
- If key A lights up the A tile but your text editor shows B, the remap is above the scan code layer, inside the OS or an application input hook.
- If key A lights up the B tile in the keyboard test, the remap is at the HID descriptor or firmware level, meaning the keyboard itself is reporting the wrong scan code.
- If the correct tile lights up intermittently or two tiles flash for a single keypress, you have a debounce or contact fault at the switch level.
Run the test with the keyboard connected directly to a USB-A port on the motherboard backplate, not through a hub. USB hubs with low-quality VIA VL812 or GL3520 controllers can drop or duplicate HID reports under load, mimicking a firmware fault.
Scan Code Remaps: Where They Live and How to Remove Them
Windows stores persistent scan code remaps in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout under the value name Scancode Map. If that binary value exists and you did not put it there intentionally, a game, a macro utility, or an accessibility tool wrote it. Delete the entire Scancode Map value, not just its contents, then reboot. The remap does not clear until the next full boot cycle.
PowerToys Keyboard Manager stores its own remap table separately at %LOCALAPPDATA%\Microsoft\PowerToys\Keyboard Manager\default.json. Open that file in Notepad, locate the remapKeys array, and remove any entry where the originalKeys or newRemapKeys field matches your affected scan code. Save and restart the PowerToys service from the system tray.
On macOS, keyboard remaps live in ~/Library/Preferences/com.apple.keyboardtype.plist and in System Settings under Keyboard, Modifier Keys. If you use Karabiner-Elements, check ~/.config/karabiner/karabiner.json for rules under simple_modifications. Use the Mac Keyboard Test to confirm output after each change without leaving the browser.
Transposition Errors from Switch and Firmware Faults
A transposition error, where two adjacent characters appear reversed in output (typing "teh" when you pressed T then H then E in correct order), is almost never a remap. It is a timing fault. The keyboard controller polls the switch matrix at a fixed interval, typically 1000 Hz on gaming boards and 125 Hz on budget office boards. If a switch returns a signal that falls between two poll cycles, the controller logs the keydown event one cycle late, and a fast typist will see the character order inverted in the output buffer.
The switches most prone to this are worn Omron D2FC-F-7N units with more than 15 million actuations, Huano Blue Shell Pink Dot switches with cracked housings causing pre-travel contact bounce, and any linear switch running without O-rings on a PCB with insufficient debounce time in firmware. Kailh GM 8.0 and TTC Gold 80M switches are rated to 80 million cycles and rarely cause debounce faults unless the gold contacts are contaminated with flux residue from a factory defect.
To isolate a specific switch, remove the keycap, use a switch puller on a hot-swap board, and test the socket with a known-good switch. On soldered boards, bridge the two switch pins with a bent paperclip and confirm in the keyboard test tool whether the fault follows the switch or stays with the socket. If it stays with the socket, the PCB trace or the diode in that matrix row is damaged.
| Symptom | Root Cause | Fix Layer |
|---|---|---|
| Key A always outputs B, consistent every press | Scan code remap in OS or firmware | Registry, plist, or firmware reflash |
| Two characters reversed when typing fast | Debounce timing fault or late poll registration | Firmware debounce value or switch replacement |
| Wrong letter only when Shift or Ctrl held | Stuck modifier sending ghost scan code | Clean or replace modifier switch, check Sticky Keys setting |
| Swapped keys only in one application | Application-level input hook or IME remap | Disable app keybind settings or IME composition mode |
| Random key fires without pressing it | Matrix short or cracked PCB trace | Visual inspection, reflow solder joint, or PCB replacement |
Modifier Keys Sending Ghost Scan Codes
A Shift, Ctrl, or Alt key with a failing switch contact is one of the most common causes of keyboard letters in wrong place reports. The switch actuates partially, sends a keydown scan code, but the contact bounce prevents a clean keyup signal. The OS holds the modifier state open. Every subsequent key you press is interpreted as a shifted or control-modified input until the modifier key physically reseats. On Windows, go to Settings, Accessibility, Keyboard and confirm that Sticky Keys and Filter Keys are both off. These accessibility features can latch modifier state in software and produce identical symptoms to a hardware ghost signal. After disabling them, press Shift five times rapidly to confirm the toggle dialog no longer appears, then retest in the Keyboard Test.
If the problem persists, remove the modifier keycap and inspect the switch. Omron D2FC-F-7N units under modifier keys wear faster than alphanumeric keys because modifier presses involve more lateral force. Spray a small amount of Deoxit D5 into the switch housing through the top gap, actuate 20 times, and retest before committing to a full switch replacement.
Frequently Asked Questions
Why are my keyboard keys swapped only in games but correct everywhere else?
The game is using DirectInput or RawInput and applying its own key binding table on top of the OS scan code. Check the in-game keybind menu and reset all bindings to default. Some anti-cheat drivers also install low-level keyboard filters that can interfere with scan code delivery.
Can a USB cable cause keyboard typing wrong letters?
A damaged USB cable can drop HID report packets, causing missed keyup events and making the controller log keys out of sequence. Swap the cable first. If the keyboard uses a detachable USB-C or mini-USB cable, inspect the connector pins for bent contacts before assuming the PCB is at fault.
My keyboard layout is set to the right language but keys are still in the wrong place. Why?
Windows allows multiple input method editors to be installed simultaneously and will switch between them with the hotkey Alt plus Shift or Windows key plus Space. You may have accidentally triggered a layout switch to a different language profile. Check the language bar in the system tray and remove any secondary input methods you do not use under Settings, Time and Language, Language and Region.
How do I know if my keyboard firmware needs reflashing?
If the swap is bidirectional (A outputs B and B outputs A) and removing all OS-level remaps does not fix it, the HID descriptor table inside the keyboard's onboard flash is corrupted. Download the firmware utility from the keyboard manufacturer's support page, run a full factory reset first, and only reflash if the reset does not restore correct output. Never interrupt a firmware write.
Does the problem affect wireless keyboards differently?
Wireless keyboards using 2.4 GHz dongles can experience packet loss that causes the receiver to misregister key order, producing transposition errors identical to a debounce fault. Move the dongle to a port within 30 cm of the keyboard, away from USB 3.0 ports which emit interference in the 2.4 GHz band. Bluetooth keyboards have higher latency by design and are more susceptible to ordering errors at typing speeds above 80 WPM.
Can I test whether the fault is in the keyboard or the computer?
Plug the keyboard into a second computer or boot from a USB Linux live environment. If the wrong output follows the keyboard to the new machine, the fault is in the keyboard firmware or hardware. If the correct output returns on the second machine, the problem is in your OS configuration, a driver, or an installed utility on the original system. The Keyboard Test running in a live OS browser session is one of the fastest ways to make this determination without installing anything.
Launch Companion Diagnostic Tool
Test your hardware right now in your browser with zero install:
Open Keyboard Tester