Can I switch the alt and ctrl keys on my keyboard?

26

14

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.

zjdrummond

Posted 2017-03-19T22:43:11.463

Reputation: 281

Question was closed 2017-11-01T17:13:27.010

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 – 2017-03-19T22:51:41.643

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 – 2017-03-20T00:24:35.740

https://superuser.com/a/1132401/494585 – Ploni – 2017-03-20T03:16:05.823

3Regularity is not my concern. No one will be using my machine but myself either. – zjdrummond – 2017-03-20T23:52:53.477

I would suggest this solution https://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).

– music2myear – 2017-11-01T17:12:01.550

The best solution I have found is to buy a JIS japanese keyboard(laptop or external) and then assign the thumb modifiers to CTRL on the keyboard using SharpKeys. Then effectively the Ctrl/Cmd keys are effectively in the same place. – William – 2018-11-28T17:32:04.137

Answers

17

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 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:

Ploni

Posted 2017-03-19T22:43:11.463

Reputation: 560

remapkey worked for me in Windows 10. – MountainX – 2018-10-14T03:25:14.930

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 – 2018-11-07T03:00:17.333

remapkey is awesome. so r u. – CopperCash – 2019-01-24T11:41:09.847

remapkey did not work for me in windows 10 – Seph Reed – 2019-09-06T03:56:18.077

13

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

Stevoisiak

Posted 2017-03-19T22:43:11.463

Reputation: 8 152

2

This will not let you swap keys so unfortunately this won't work. https://github.com/randyrants/sharpkeys

– William – 2018-09-18T22:38:24.737

See my comment https://superuser.com/questions/1190329/can-i-switch-the-alt-and-ctrl-keys-on-my-keyboard#comment2078769_1202601 that agrees with @William

– gabe – 2018-11-28T17:16:53.663

SharpKeys may now be used to swap keys with each other. Latest README may be found here: https://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"

– Arthur Rimbun – 2019-04-18T12:44:24.583