50

I'm a long time Mac user, but I just built a PC. Not liking the ctrl and alt keys locations. I'm always expecting the ctrl key to be where the command key is on my Macbook. Can I moved swap these somehow? I'm running Windows 10, and I'm up to date.

6
  • As you might imagine, this is a rather popular request. While there may be some minor quirks involved with the process, other community members have done it using AutoHotkey as seen both here and here.
    – Run5k
    Mar 19, 2017 at 22:51
  • 1
    I would say not to do that, for several reasons. First, this prevents you from ever learning to use the keyboard regularly - if you ever need to use someone else's computer, this will make it hard for you. Also, it will make it hard for other people to use your computer. Finally, in my experience (a Windows user who sometimes has to use a Mac for work), it takes only a few days to get used it the change the first time, and it takes only a minute or two to change between them as I switch between computers over the course of a day.
    – Moshe Katz
    Mar 20, 2017 at 0:24
  • superuser.com/a/1132401/494585
    – Ploni
    Mar 20, 2017 at 3:16
  • 4
    Regularity is not my concern. No one will be using my machine but myself either.
    – zjdrummond
    Mar 20, 2017 at 23:52
  • I would suggest this solution superuser.com/questions/36920/how-can-i-remap-a-keyboard-key rather than an AutoHotkey solution. Remapping keys in Windows can be done with Registry modification and the use of the SharpKeys utility (which does the registry modification and does not need to remain running full-time to intercept keys). Nov 1, 2017 at 17:12

2 Answers 2

31

For remapping any physical key on the keyboard is a registry entry.

It's in [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
You create a key with the name Scancode Map. It can redirect any key to another key or disable it.

That key is a hex-value with the following meaning:

00,00,00,00 Header: Version. Set to all zeroes.
00,00,00,00 Header: Flags. Set to all zeroes.
05,00,00,00 5 entries in the map (including null entry).
38,00,1d,00 Left CTRL -> Left ALT (can also be another key).
1d,00,38,00 Left ALT -> Left CTRL.
38,e0,1d,e0 Right CTRL -> Right ALT.
1d,e0,38,e0 Right ALT -> Right CTRL.
00,00,00,00 Null entry.

To swap the CTRL and ALT keys you need four entries (plus null).
The Left Left-CTRL (1d 00), the Left Left-ALT (38 00), the Right-CTRL (1d e0), and the Right-ALT (38 e0).

So you can create a .reg file like this: Disable_CTRL-key.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,05,00,00,00,38,00,1d,00,1d,00,38,00,38,e0,1d,e0,1d,e0,38,e0,00,00,00,00

Execute (double click) the .reg file and log out and back in (or restart your computer). Now your CTRL and ALT keys should have been swapped.

Other useful keys to know:

1d 00    Left Ctrl
1d e0    Right Ctrl
38 00    Left Alt
38 e0    Right Alt
5b e0    Left Windows Key
5c e0    Right Windows Key
5d e0    Windows Menu Key

(Based on this answer by Rik)

If you are not comfortable with changing the registry or you want other keys too you can use the program SharpKeys to edit them more easily. It also has a convenient list of all keys so you can just add them in a window.

While SharpKeys (perhaps - I cannot actually verify that it did work) used to be an alternative option, SharpKeys' current Readme states that SharpKeys cannot be used for this purpose, although it can be used for other key remappings. (h/t gabe)


Alternatively, I found the Windows Server 2003 Resource Kit Tools (archived download) which contains a small executable called remapkey.exe, only 340KB in size. It is a graphical program which allows you to remap the keys of your keyboard. A reboot is required, as with any manual change. In Windows Vista+ it will require Admin privileges.

While looking for some screenshots, I came across another answer on this site which recommends it:

The best tool for the job is Microsoft's own remapkey, available as part of the Windows Resource Kit. (That link is for Windows 2003; I've used it successfully over the years on many versions of Windows, including Windows 7; have not tested Windows 8).

remapkey will write the mapping directly into the registry, I believe, and does not require a running process. You simply drag from actual key to desired key, and save.

remapkey screenshot


Further Reading:

6
  • 1
    remapkey worked for me in Windows 10.
    – MountainX
    Oct 14, 2018 at 3:25
  • Another plus for remapkey on Windows 10. It felt a bit sketchy installing the Windows 2003 Kit on WIndows 10, but all worked. It sure beats always running autohotkey in the background, thanks!
    – PKKid
    Nov 7, 2018 at 3:00
  • remapkey is awesome. so r u.
    – CopperCash
    Jan 24, 2019 at 11:41
  • 1
    remapkey did not work for me in windows 10
    – Seph Reed
    Sep 6, 2019 at 3:56
  • 1
    remapkey is still working on Windows 10 (10.0.18363)! I used it to swap the Right Shift and "ç" key for reasons that will exceed the maximum number of characters for this comment 🙂 I couldn't find it on Microsoft's site, though. I used this link: news.ycombinator.com/item?id=20485212 (yeah, sketchier and sketchier 😄) Mar 24, 2021 at 22:52
29

The key remapping utility Sharpkeys (Download) should let you rebind your keys however you'd like. (Source)

Steps:

  1. Open Sharpkeys and click Add
  2. Add the following two entries as key mappings

    From:                           To:
    Special: Left Alt (00_38)       Special: Left Ctrl (00_1D)
    Special: Left Ctrl (00_1D)      Special: Left Alt (00_38)
    
  3. Confirm your remappings, then click Write to Registry

6
  • 2
    This will not let you swap keys so unfortunately this won't work. github.com/randyrants/sharpkeys
    – William
    Sep 18, 2018 at 22:38
  • See my comment superuser.com/questions/1190329/… that agrees with @William
    – gabe
    Nov 28, 2018 at 17:16
  • 5
    SharpKeys may now be used to swap keys with each other. Latest README may be found here: github.com/randyrants/sharpkeys It states on the page that SharpKeys will "allow you to swap two keys with each other - e.g. you can swap Left Windows with Left Control and vice versa" Apr 18, 2019 at 12:44
  • 2
    SharpKeys can swap two keys each other, just tested and works in Win10.
    – apr
    Nov 18, 2020 at 7:46
  • Tested in Windows 11. Works flawlessly.
    – Joel
    Aug 25, 2021 at 1:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.