Windows keyboard guide
PowerToys vs Scancode Map vs AutoHotkey: Which Swaps Keys Best?
Three free tools can swap two keys in Windows, and each one stores the swap in a different place. Pick by where the swap has to live.
PowerToys vs Scancode Map vs AutoHotkey: quick answer
PowerToys Keyboard Manager suits most PCs because it needs no restart and shows every mapping in a list. A registry Scancode Map suits shared PCs and sign-in-screen swaps. AutoHotkey suits swaps that depend on which program has focus. All three are free to use.
The three methods side by side
The methods differ in three things that matter for a swap: where the mapping is stored, what must be running for it to work, and what it cannot reach. The table keeps those columns together so you can scan across.
| Method | Stored in | Needs running | Restart needed | Cannot reach |
|---|---|---|---|---|
| PowerToys Keyboard Manager | PowerToys settings | PowerToys, in the background | No | Sign-in screen; elevated windows unless PowerToys is elevated |
| Scancode Map | Registry, whole machine | Nothing | Yes, or sign out | Per-user or per-keyboard rules |
| AutoHotkey v2 script | A .ahk file | The script process | No | Elevated windows without UI access; some games |
Use the filter chips to narrow the table to the trait you care about. The chips only hide rows; nothing is removed from the page.
PowerToys Keyboard Manager
PowerToys is a Microsoft utility with a Keyboard Manager tab. Select Remap a key, add two rows and select OK. The mapping takes effect immediately and stays while PowerToys runs.
Strengths: a visible list, an undo that is just deleting a row, and a Select button that listens for the physical key. Limits: it needs Windows 11 or Windows 10 version 2004 or later, it does not load on the sign-in screen, and Microsoft warns it may reduce frame rates in some games.
Registry Scancode Map
The Scancode Map is a binary value in HKEY_LOCAL_MACHINE under Keyboard Layout. Windows reads it at startup, so it needs no program in the background and applies to every user and every keyboard.
Strengths: nothing to keep running and the broadest reach among the three. Limits: administrator rights, a restart, an easy mistake if you hand-edit hex, and an overwrite risk when you import a second .reg file. The registry swap writer in the main guide produces the value for any two keys on its list.
AutoHotkey v2 script
AutoHotkey swaps two keys with two lines, a::b and b::a, while the script runs. Its real strength is conditions: the same swap can apply only in one program, or only while a modifier is held.
Its limits are the flip side. A script that ends takes the swap with it, elevated windows need UI access, and the AutoHotkey documentation itself notes that some games ignore remaps and that registry remapping is cleaner. Treat it as the tool for conditional swaps, not the default for plain ones.
#HotIf WinActive("ahk_exe notepad.exe")
a::b
b::a
#HotIfWhich one should you pick?
Choose by the owner of the PC and the place the swap must apply. Your own PC points to PowerToys, a shared or locked PC to the registry, and a swap tied to one program to AutoHotkey.
| If this is true | Pick |
|---|---|
| You own the PC and want the quickest result | PowerToys |
| The swap must work before sign-in or for every user | Scancode Map |
| The swap must change by program or modifier | AutoHotkey |
| You need to change a character, not a key | A custom keyboard layout from Microsoft Keyboard Layout Creator |
In every method, write both directions and keep the undo step beside them.
Frequently asked questions
Which is better for swapping keys: PowerToys or the registry?
PowerToys is better for most people because it applies at once and has a visible list of mappings. The registry is better for shared PCs or when the swap must apply before sign-in, since it belongs to the machine, not to a running app.
Is AutoHotkey better than PowerToys for key swaps?
Only when the swap depends on conditions, such as one program or a held modifier. AutoHotkey’s own documentation notes that registry remapping is more pure, and some games ignore script remaps. For a plain swap, PowerToys is simpler.
Do I need administrator rights for each method?
The registry method always does. PowerToys can install per user without administrator rights, and AutoHotkey runs from a script file. Elevated windows are the exception: they ignore a tool that is not itself elevated.
Can I use two methods at once?
You can, but it makes testing harder. Two tools may both change the same key, and the result depends on the order they process it. Pick one method per key and keep a written note of which one owns it.
Which method survives a Windows update?
The registry value normally persists, since it is stored settings and not a program. PowerToys and AutoHotkey also persist, as long as they still start at sign-in. After a major update, run the four checks from the main guide again.
Where to go next
Install steps and the registry writer are in the main guide’s methods section. If a swap already misbehaves, go to the troubleshooting page.