Windows keyboard guide
How to Swap Two Keys on a Keyboard in Windows: Step-by-Step Guide 2026
Swapping two keys on a Windows keyboard takes about five minutes with the right free tool. This guide covers PowerToys, the registry and AutoHotkey, then shows how text macros and hotkeys fit alongside a swap.
How to Swap Two Keys on a Keyboard in Windows: Quick Answer
To swap two keys on a keyboard in Windows 11 or Windows 10 (version 2004 or later), install Microsoft PowerToys, open Keyboard Manager, select Remap a key, and add two rows: A sends B, and B sends A. Select OK and the swap works immediately. If the swap must load without a running app, write a Scancode Map value in the registry and restart. Both methods are free. Microsoft’s own remapping guide points to PowerToys for this job.
| Applies to | Windows 11 and Windows 10 version 2004 or later, x64 or Arm64 |
|---|---|
| Time needed | About 5 minutes with PowerToys, about 10 with the registry and a restart |
| Difficulty | Easy with PowerToys, moderate with the registry |
| Cost | Free for PowerToys, AutoHotkey and the registry method |
| Needs admin or internet | Admin for the registry method and for elevated windows; internet only to download a tool |
| Last verified | November 2026 |
What you need before you swap two keys on a Windows keyboard
Before you swap two keys on a Windows keyboard, confirm three things: your Windows version, whether you can install an app or write to the registry, and exactly which two keys you mean, including left or right for Ctrl, Alt, Shift and Win.
- Windows version. Press Win+R, type
winverand press Enter. PowerToys needs Windows 11, or Windows 10 version 2004 (build 19041) or newer, on an x64 or Arm64 processor. - Install and admin rights. PowerToys offers a per-user install that lands in
%userprofile%\AppData\Local\Programs, and a machine-wide install in Program Files. The registry method always needs administrator rights. - Your two keys. Write them down with their position, for example “Left Ctrl and Caps Lock”. A swap that names only “Ctrl” is ambiguous because most keyboards have two.
Swap two keys on a keyboard in Windows: what counts as a swap
A swap is two mappings that point at each other. Press the first key and Windows receives the second key’s code; press the second and it receives the first. Nothing changes in the keyboard hardware. The mapping lives in software, so deleting it restores the original layout.
Swapping keys damages or reprograms the keyboard.
Every method here is a software mapping. Delete the mapping and the physical keyboard behaves as before.
One row is enough to swap two keys.
One row only redirects one key. A second row is needed so the other key returns the favour; without it you lose a key.
Every swap needs two mappings (A sends B, B sends A) plus one written undo step stored beside them. If any of the three is missing, the swap is unfinished.
PowerToys is Windows 11 and Windows 10 2004 or later only. The registry value and AutoHotkey reach older Windows versions, but this guide covers current releases.
Swap methods
Best Free Methods to Swap Two Keys on a Keyboard in Windows
Four free routes exist. Each one stores the two rows in a different place, and that place decides what survives a restart, an admin window or the sign-in screen.
01/ PowerToys Keyboard Manager
Microsoft’s free utility adds a Keyboard Manager tab where Remap a key takes two rows and applies them when you select OK, with no restart. Mappings work only while PowerToys runs, so switch on Run at startup in General. Keyboard Manager does not load on the sign-in screen, and an app running as administrator ignores it unless PowerToys also runs as administrator.
02/ Scancode Map in the registry
Windows reads a binary value named Scancode Map under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout. Because the value belongs to the whole machine and not to a running program, it can apply before sign-in; test that on your own PC. Changes need a restart or a sign-out. SharpKeys, a free open-source tool, writes the value through a window instead of by hand.
03/ AutoHotkey script
Two lines in AutoHotkey v2, a::b and b::a, swap the pair while the script runs. AutoHotkey’s own documentation calls this approach less pure than registry remapping, and some games ignore it. A script needs a shortcut in the Startup folder to return after a restart.
04/ A custom keyboard layout file
Microsoft Keyboard Layout Creator 1.4 builds an installable layout in which two keys exchange characters. It changes what a key types, not which physical key is pressed, and its window will not edit Backspace, Tab, Caps Lock, Return, Shift, Ctrl or Alt. It suits language and character work more than a plain swap.
Need the full side-by-side with timing, scope and setup effort? The detailed comparison of PowerToys, Scancode Map and AutoHotkey for key swaps sits on its own page, so this guide keeps the short version.
Read the full PowerToys vs Scancode Map vs AutoHotkey comparison
| Method | Difficulty | Reach | Cost | Best for | Limitations |
|---|---|---|---|---|---|
| PowerToys Keyboard Manager | Easy | Your user session while PowerToys runs | Free | Most home and office PCs | No sign-in screen; Fn key mostly out; elevated windows need an elevated PowerToys |
| Scancode Map (registry) | Moderate | Whole machine, every keyboard | Free | Shared PCs, kiosks, pre-sign-in swaps | Admin rights and a restart; two-byte codes only; no per-user setting |
| AutoHotkey v2 script | Moderate | Your user session while the script runs | Free | App-specific rules and conditions | Elevated windows need UI access; some games ignore it |
| Keyboard layout file | Hard | Installed language layouts | Free | Character changes, not modifier keys | Cannot edit Ctrl, Alt, Shift, Caps Lock or Tab in the window |
| Macro Keys (text macros) | Easy | Typed text and launches while it runs | Free | Replacing repeated typing | Does not swap keys; the official page documents no key remapping |
| Verdict | For most readers PowerToys is the swap tool. Pick the registry method when the PC is shared or the swap must exist before sign-in. | ||||
PowerToys, AutoHotkey and the registry method cost nothing to use.
Two rows make one swap: A sends S and S sends A.
Sources checked for this guide in November 2026
Works on Windows 10 and 11
Step-by-Step: Swap Two Keys on a Keyboard in Windows
To swap two keys with PowerToys, open Settings, choose Keyboard Manager, select Remap a key, add a row for each direction, and select OK. Microsoft’s documentation uses A and B as the example: A to B, then B to A in a second row.
- Install PowerToys
Download the installer from the PowerToys releases page, or install it from the Microsoft Store, or run the winget command below. The installer also adds the Microsoft Edge WebView2 Runtime if it is missing.
- Open Keyboard Manager
Open PowerToys Settings, select the Keyboard Manager tab, and turn on Enable Keyboard Manager.
- Add the first row
Select Remap a key, then Add key remapping. In the Select column, choose the first key (press Select and tap the key, or use the drop-down). In To send, choose the second key.
- Add the second row
Add another remapping with the keys reversed: the second key in Select, the first key in To send.
- Select OK
Changes take effect immediately. If Windows shows an orphaned-key warning, you have probably added only one row.
- Keep it after a restart
Open General in PowerToys Settings and turn on Run at startup. Remapping works only while PowerToys is running in the background.
winget install Microsoft.PowerToys --source winget
Write the registry swap yourself
This writer builds a Scancode Map value for any two keys on the list, using the same binary layout SharpKeys writes. Pick two keys, copy the text into a file ending in .reg, and open it with administrator approval. Restart Windows afterwards.
Importing this file replaces any Scancode Map value already on the PC, including one written by an IT department or a tool such as SharpKeys. Open the Keyboard Layout key in regedit first and note whether the value exists. Keys with three-byte scancodes cannot be remapped this way.
Swap with an AutoHotkey v2 script
Install AutoHotkey v2, save the lines below in a file ending in .ahk, and double-click it. Each line handles one direction, and the second line is what makes it a true swap. To run it after a restart, press Win+R, enter shell:startup, and paste a shortcut to the file into the folder that opens.
a::b b::a
How to Verify It Worked After You Swap Two Keys on a Keyboard in Windows
Verify a key swap with four tests: type both keys in Notepad, repeat the test inside an app run as administrator, restart Windows and test again, and, for the registry method, test at the sign-in screen. A swap that passes all four is finished.
- Open Notepad and press each swapped key once. The first key should print the second key’s character, and the reverse.
- Hold Shift and press both keys, then toggle Caps Lock. Mapped keys should follow the same rules as unmapped ones.
- Right-click an app, choose Run as administrator, and type again. PowerToys documents that remapping does not reach an elevated window unless PowerToys itself runs as administrator.
- Restart Windows and sign in. If the swap vanished, PowerToys is not set to run at startup, or the AutoHotkey shortcut is missing from the Startup folder.
- Registry method only: at the sign-in screen, type a few characters into the password box with the swapped keys, then confirm the password still goes in as you expect.
| Test | PowerToys | Scancode Map | AutoHotkey |
|---|---|---|---|
| Notepad, same session | Pass at once | Pass after restart or sign-out | Pass while the script runs |
| App run as administrator | Pass only if PowerToys is elevated | Pass | Pass only with UI access or an elevated script |
| After a restart | Pass if Run at startup is on | Pass | Pass if the Startup shortcut exists |
| Sign-in screen | Does not apply | Test it on your PC | Does not apply |
Common Mistakes When You Swap Two Keys on a Keyboard in Windows
The most common mistake when you swap two keys on a Windows keyboard is adding only one of the two mappings, which leaves both keys typing the same character. Six other slips cause most of the remaining trouble.
With only A to B, pressing A and pressing B both type B. PowerToys warns about the orphaned key; the registry and AutoHotkey do not.
Remapping Win, Ctrl, Alt or Shift can break gestures and special keys, and AltGr behaves as Left Ctrl plus Right Alt, so touching either key can break it. Write the undo step first.
Keyboard Manager stops the moment PowerToys exits. Turn on Run at startup, and check that the tray icon is present after a restart.
A .reg file replaces the whole value. A second swap added this way erases the first one, so combine all pairs in one value.
PowerToys mappings follow the active input language. A to B on English (US) applies to the physical key that types A on a French layout, so test with the layout you actually use.
An elevated app, a remote session or a game may ignore the swap that Notepad obeyed. Run the four tests in the section above.
Troubleshooting a key swap that stopped working
When a key swap stops working, the cause is usually the tool’s scope, not the mapping: PowerToys not running, an administrator window, a game, or a laptop Fn key. Match your symptom in the table, then run the checklist.
| Problem | Likely cause | Fix |
|---|---|---|
| Swap works in Notepad, not in one program | The program runs as administrator | Run PowerToys as administrator, or use the registry method |
| Swap disappears after a restart | PowerToys or the script does not start at sign-in | Turn on Run at startup, or add the script to shell:startup |
| Both keys type the same character | Only one row was added | Add the reverse row |
| Fn key will not map | Keyboard firmware handles Fn | Swap the keys around Fn instead |
| Hotkey opens the wrong thing | Windows or another app reserves the combination | Choose another combination; Win+G opens Game Bar even when reassigned |
This section stays short on purpose. The full symptom list, with causes for Fn keys, remote sessions and keys swapped by accident, lives on a separate page: fixes when swapped keys stop working or will not go back.
Is This Enough? What Else to Do After You Swap Two Keys on a Keyboard in Windows
A swap is only done when you have tested it, written the undo step and checked the places it does not reach: the Fn key, the sign-in screen, administrator windows, games and anyone else who uses the PC.
Score your own setup below. The scorecard is a thinking aid, not a security rating; it simply counts the loose ends that cause most help requests.
How to undo a key swap
Undo steps differ by method, and the registry route is the only one that needs a restart.
| Method | Undo |
|---|---|
| PowerToys | Open Remap a key, delete both rows, select OK. Or close PowerToys, or turn off Keyboard Manager. |
| Scancode Map | Delete the Scancode Map value in the Keyboard Layout key, or import the undo file above, then restart. SharpKeys recommends Safe Mode if a mapping locks you out. |
| AutoHotkey | Exit the script from its tray icon and remove its shortcut from shell:startup. |
Laptop owners have extra limits to plan around. The page on which laptop keys can be swapped and which cannot lists them.
Where Macro Keys fits when you swap two keys
We recommend PowerToys for the swap itself and Macro Keys for what a swap cannot do: expanding short triggers into text, launching programs with a key combination, and keeping several clipboard items. Macro Keys does not remap or swap keys.
Macro Keys is a free Windows program from NewSoftwares.net, the developer behind this guide. Its product page lists keyboard macros, text shortcuts, multiple clipboards, a hotkey launcher and macro encryption. It does not list key remapping, so we do not offer it as a swap tool.
The fit is the next problem people hit. After a swap, readers often want a second kind of shortcut: type a few characters and get a full sentence, or press one combination and open a folder. That is the job Macro Keys covers, alongside PowerToys instead of in place of it.
What Macro Keys costs
The official page offers Macro Keys as a free download for Windows and lists it under free apps. Microsoft’s developer site describes PowerToys as free as well. Pricing, version and system requirements are not stated on the Macro Keys page, so we do not quote them.
- Text shortcuts that expand to longer text
- Hotkey launcher for programs, folders, websites and email
- Several clipboard items kept and re-pasted
- No key swap or remap feature documented
- No per-keyboard setting documented
- Version and requirements not stated on the product page

Features, with where each fits
| Feature | Best for | Not ideal for |
|---|---|---|
| Text shortcuts | Repeated phrases, addresses, sign-offs | Changing which character a key types |
| Hotkey launcher | Opening a program, folder, website or new email | Typing text into a form |
| Multiple clipboards | Pasting something copied three copies ago | Long-term storage of sensitive text |
| Macro encryption and a start-up password | A personal PC where others might open the app | Replacing PC-level protection |
What Keyboard Macros Can Automate
A keyboard macro replaces a repeated action with a short trigger. In Macro Keys, per its product page, that covers replacement text, key combinations that launch programs, folders, websites and email, and a clipboard that keeps several copied items.
| Macro type | What it does | Where in Macro Keys | Example |
|---|---|---|---|
| Text | Replaces a trigger with longer text | Macro Shortcuts tab | Trigger ,sig types a full sign-off |
| Key sequence | Adds keystrokes such as Tab, Enter or arrows inside a text macro | Virtual keyboard in the macro dialog | Tab between form fields |
| Launch | Opens a program, folder, website or email | Hotkey Launcher tab | Open a project folder |
| Clipboard | Pastes an earlier copied item from a numbered slot | Multiple Clipboards tab | Paste the second last copy |
| Mouse | Not listed on the official page | Not documented | Use another tool |
Macros vs keyboard shortcuts vs text expansion
A macro runs a sequence you define, a keyboard shortcut calls one fixed command that an app or Windows already has, and text expansion swaps a typed abbreviation for longer text. Macro Keys covers text expansion and key-combination launching.
The three differ in who defines the action. Ctrl+C belongs to the app. A text expansion belongs to you and runs only when you type its trigger. The side-by-side with a decision helper is on the page that compares a macro, a hotkey and a text expander.
Recording vs scripting macros
In Macro Keys, a macro is built from typed text plus keystrokes added from an on-screen virtual keyboard, not from a script language. A German review describes it as able to record and replay tasks; the official page does not use the word recording.
That difference matters when you choose a tool. A scripting tool such as AutoHotkey can branch, wait and test conditions. A text-based macro tool is simpler and safer to hand to a colleague, but it cannot decide anything. Read the German-language Macro Keys walkthrough on Datacenter-Insider (March 2022) if you want a second description, and try the recording claim on your own copy before relying on it.
Recording Your First Macro
To create your first macro in Macro Keys, open the Macro Shortcuts tab, select Add Macro, type a short trigger in the Macro (Trigger) box, enter the replacement in Text to Send, and select Ok. Type the trigger anywhere and the text appears.
- Open Add Macro
On the Macro Shortcuts tab, select Add Macro at the bottom of the window.
- Name the trigger
Type a short trigger in the Macro (Trigger) box. The screen suggests a short shortcut text that will be replaced with the text to send.
- Enter the text
Type or paste the replacement in the Text to Send box. Use the virtual keyboard buttons for keystrokes such as Tab, Enter, Date or Time.
- Select Ok
The macro appears in the list with its trigger and replacement text.
- Test it
Open Notepad, type the trigger, and confirm the full text appears.

The Options screen has a Use Prefix field, shown with a comma in the official screenshot. A prefix gives every trigger a shape that ordinary words never have, so triggers do not expand by accident.
Assigning Macros to Specific Keys
Assigning a macro to a key combination happens on the Hotkey Launcher tab in Macro Keys, which the product page describes as a way to launch software, open folders, open websites or send email. Text macros use typed triggers instead.
Launching apps and websites with one key
Pick a combination that Windows and your other apps do not already own. PowerToys documents that Win+L and Ctrl+Alt+Del are reserved by Windows, and that Win+G opens Game Bar even when another tool claims it. Combinations with Ctrl+Alt plus a letter are risky on layouts that use AltGr, because AltGr behaves as Left Ctrl plus Right Alt.
Assigning macros to a second keyboard or keypad
The tools in this guide cannot give a second keyboard its own macros. PowerToys applies mappings to every keyboard, the registry value is machine-wide, and Macro Keys documents no per-keyboard setting.
A macro pad that stores macros in its own firmware or vendor software is the usual route for a dedicated second device. Check that vendor’s documentation for key limits and profile switching, because it is outside the scope of anything here.
Macros for data entry and office workflows
Text macros pay off where the same phrase, address or reference is typed many times a day. A Tab keystroke added to a macro can also step through form fields, so one trigger fills several boxes.
Macros for Excel and data-entry teams
Excel moves one cell right on Tab and down on Enter, so a macro that types a value, presses Tab, types a second value and presses Tab again can fill a row. Add the Tab and Enter buttons from the virtual keyboard rather than typing a tab character. Keep each macro to one row, and test it on a copy of the sheet.
Macro timing, delays and reliability tips
Macro Keys documents no delay setting, so keep every macro short and let the target app finish loading before you type a trigger. Reliability comes from testing in the exact app where the macro will run, not from a longer sequence. If a window takes two seconds to open a form, wait for the cursor to appear before you fire the trigger.
Safe macro use at work
Get written approval before you run a key-swap or macro tool on a work PC, because these tools sit between the keyboard and every app, which is exactly where IT policy and endpoint security look.
- Ask your IT team first, even for a per-user install that needs no administrator rights.
- Never store passwords, card numbers or client data in a text macro or a clipboard slot.
- Do not use a macro to bypass a workplace control. This guide does not cover that.
- Share exported macro files only through channels your employer approves.
Fixing Macros That Misfire
A macro misfires for one of five reasons: a trigger that appears inside ordinary words, an elevated target window, a hotkey Windows already owns, a clipboard slot that moved, or a macro file that did not survive a reinstall.
| What happens | Cause | Fix |
|---|---|---|
| Text expands inside a normal word | Trigger has no distinguishing prefix | Use the Use Prefix field and start every trigger with it |
| Nothing happens in one app | The app runs as administrator | Test with the tool elevated, or try the app unelevated |
| Hotkey opens another program | Windows or another app owns the combination | Choose another combination |
| Clipboard slot holds a different item | New entries are added on top | Check the Add New Entries on Top option in Options |
| Macros missing after a reinstall | No export file existed | Export macros to a file and import them on the new install |
The clipboard order depends on the Add New Entries on Top option, and the Fetch Clipboard on Load option pulls current clipboard content when the program starts. If slot /c01 holds something unexpected, those two settings are the first place to look.
The ID.nl article, a Dutch-language hotkey guide that covers Macro Keys (updated December 2022), describes the clipboard history in similar terms.

Backing Up and Sharing Your Macros
Macro Keys backs up macros through the Export Macros to File and Import Macros from File buttons, found in Options and in the macro dialog. The Set Path field shows where the macro data folder lives. Copy the exported file to two other places.
- Open Options and select Export Macros to File.
- Save the file outside the Macro Keys data folder.
- Copy it to a second location, then a third on a different device.
- On a new PC or after a reinstall, select Import Macros from File.
Treat the exported file like any document that holds your text snippets. Keep it in an encrypted folder or on a password-protected USB drive if the snippets contain anything private, and share it only with people who should see that text.
Keep the working copy, one export beside it, and one export on a different device. Check the third copy restores before you need it.

Frequently asked questions about swapping two keys on a Windows keyboard
Filter by topic, or read them all.
How to swap two keys on a keyboard in Windows?
Install Microsoft PowerToys, open Keyboard Manager, select Remap a key, and add two rows: A sends B and B sends A. Select OK and the swap works at once. For a machine-wide swap that loads without a running app, write a Scancode Map value in the registry and restart Windows.
Can I swap two keys on a keyboard in Windows without paid software?
Yes. PowerToys, AutoHotkey and the registry Scancode Map method are all free to use. PowerToys needs Windows 11 or Windows 10 version 2004 or later. The registry method needs administrator rights and a restart. None of the three requires a licence key or an account.
What is the fastest way to swap two keys on a keyboard in Windows?
PowerToys Keyboard Manager is fastest once installed: two rows, select OK, and the swap is live without a restart. Expect about five minutes including the download. The registry method takes longer because Windows only reads the Scancode Map value after a restart or a sign-out.
What mistakes should I avoid when I swap two keys on a keyboard in Windows?
Adding only one of the two rows is the usual error: both keys then produce the same character and one key is lost. Also avoid swapping Ctrl, Alt or Win without a written undo step, overwriting an existing Scancode Map value, and testing only in Notepad.
How do I check that it worked after I swap two keys on a keyboard in Windows?
Open Notepad, press each key once and read what appears. Then repeat the test in an app run as administrator, after a restart, and, for the registry method, at the sign-in screen. A swap that passes all four checks is finished.
What is the difference between a macro and a keyboard shortcut?
A keyboard shortcut calls one fixed command that an app or Windows already defines, such as Ctrl+C. A macro is a sequence you define: typed text, keystrokes, or a launch action. Text expansion is the narrow case where a short trigger becomes longer text.
Can I assign macros to a second keyboard?
Not with the tools in this guide. PowerToys documents that mappings apply to all keyboards, the registry value is machine-wide, and Macro Keys documents no per-keyboard setting. A macro pad that stores macros in its own firmware or vendor software is the usual route.
Are keyboard macros allowed at work?
That depends on your employer. Remapping and macro tools sit between the keyboard and every app, so many IT policies restrict them. Ask for written approval first. Never store passwords or client data in a text macro, whatever the policy says.
Will macros work inside every application?
No. A tool that is not elevated usually cannot type into a window running as administrator, and some games read the keyboard through paths that remapping tools never see. Test each macro in the exact app where you plan to use it.
How do I back up my macros?
In Macro Keys, use Export Macros to File in the Options screen or in the macro dialog, then copy the exported file to a second folder and a third location. Use Import Macros from File on the new PC or after a reinstall to bring them back.
How do I undo a key swap in Windows?
Delete the two rows in PowerToys Remap a key, or close PowerToys. For the registry method, delete the Scancode Map value in Keyboard Layout and restart. For AutoHotkey, exit the script from its tray icon and remove it from the Startup folder.
Does swapping keys work on a laptop keyboard?
Mostly yes. Letter keys, Ctrl, Alt, Caps Lock and the function row F1 to F12 can be swapped. The Fn key usually cannot, because the keyboard firmware handles it before Windows sees a keypress. Swap around Fn instead of trying to include it.
Can I swap two keys on only one keyboard?
Not with these tools. PowerToys applies mappings to every keyboard, the registry value is global, and an AutoHotkey remap works on all keyboards by default. If you need a swap on one keyboard only, look at that keyboard’s own driver software or firmware.
Do swapped keys work in games?
Often not reliably. PowerToys warns that Keyboard Manager may reduce frame rates and that some keyboard APIs bypass it, and AutoHotkey notes that some games ignore remaps. The registry method reaches more games because it works below the app layer.
Our verdict: choose the swap method by who owns the PC
Use PowerToys on a PC you own and manage, the registry Scancode Map on a shared or locked PC, and AutoHotkey when the swap must depend on the app in focus. Add Macro Keys when your next need is typed text or launchers, not a swap.
Whatever you pick, follow the two-row rule: both mappings, then the undo step in writing. Test the swap in an elevated app and after a restart, because that is where most swaps fail.
If you came for the swap, you can stop at PowerToys and keep the registry undo file somewhere safe. If you also repeat the same typing every day, Macro Keys is a free place to start.
This guide is published by the NewSoftwares.net team, the developer of Macro Keys. We cover free and built-in options alongside our own, and the swap methods here do not depend on our product. Questions or corrections? Contact the developer.