How to remap keys on Windows

How I remapped my Windows key to the ctrl key.

March 25, 2022

4 minute read

Table of Contents

I’ve been using Windows 11 for the past couple days, and it’s been tough getting re-used to my meta key on my HHKB2 being the Windows key instead of the macOS Command key.

This has made keyboard shortcuts difficult, as my muscle memory presses the meta key and then I get any number of things in my face: the Windows Start Menu, File Explorer, even Teams, which comes with Windows 11 now.

Rather than retrain valuable muscle memory, I remapped the Windows key to act as the ctrl key instead, using the Windows Registry.

Remap keys with the Windows Registry

This is how I remapped my Windows key to the ctrl key.

Steps:

  1. Create a new file in your text editor of choice (Sublime, Notepad.exe)
  2. Add the corresponding code below according to which keys you want to map
  3. Save the file as a .reg file, e.g. win-key-to-ctrl.reg
  4. Back up your registry (important!) by opening the Registry Editor and choosing File > Export and saving the resulting file
  5. Open up the .reg file you just created
  6. Click Yes on the “Are you sure you want to continue?” warning
  7. Reboot

Registry codes

Put one of these in your .reg file:

Right Windows key to right ctrl:

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,02,00,00,00,1d,e0,5c,e0,00,00,00,00

Left Windows to left ctrl:

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,02,00,00,00,1d,00,5b,e0,00,00,00,00

Both Windows keys to both ctrls:

This is the one I used.

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,03,00,00,00,1d,00,5b,e0,1d,e0,5c,e0,\
  00,00,00,00

Reverting changes

To revert the registry changes back, you have two options:

  • Restore the backup you made previously, and reboot
  • Delete the Scancode Map registry value

Deleting the Scancode Map registry value

According to the docs, you can safely delete this registry value if you want to revert the changes you made.

Steps:

  1. Open Registry Editor by typing regedit in the Start Menu or Run
  2. Back up your registry (important!) by opening the Registry Editor and choosing File > Export and saving the resulting file
  3. Go to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout (you can put this in the handy dandy address bar they added in 2016)
  4. Delete Scancode Map
  5. Reboot

Remap keys with third-party software

There’s a couple of utilities that make it easier to add scancode mappings to the registry:

If you don’t want to mess with the registry, you can also use Microsoft PowerToys, which needs to be running in the background to work. It has some advantages and disadvantages over the registry method.

Using SharpKeys

You can download SharpKeys from the GitHub releases page or via the Windows Package Manager:

winget install sharpkeys

Steps:

  1. Back up your registry (important!) by opening the Registry Editor and choosing File > Export and saving the resulting file
  2. Open SharpKeys
  3. Add your mapping by clicking the Add button
  4. Click the Write to Registry button
  5. Reboot

SharpKeys application window

SharpKeys does have a bug where minimizing the window causes it to freak out, so watch for that.

Using Scancode Map

You can download Scancode Map from the GitHub releases page.

Steps:

  1. Back up your registry (important!) by opening the Registry Editor and choosing File > Export and saving the resulting file
  2. Open Scancode Map
  3. Add your mapping by clicking the plus symbol in the toolbar
  4. Click Apply
  5. Reboot

Scancode Map application window

It also comes with a helpful scancode viewer to help you figure out key maps:

Scancode Viewer application window

Using Microsoft PowerToys Keyboard Manager

PowerToys can’t remap all keys, and some Windows key combinations won’t be remapped. Also, some games and applications may not recognize the PowerToys remapping.

Key advantages (pardon the pun) over the registry method:

  • Change key maps without rebooting
  • Map keys to key combinations
  • Remap shortcuts
    • Including app-specific shortcuts

Steps:

  1. Open PowerToys
  2. Right-click on the taskbar tray icon and click Settings
  3. Go to Keyboard Manager
  4. Enable Keyboard Manager
  5. Click Remap a key
  6. Click the plus sign
  7. Add your mapping
  8. Click OK at the top of the window to save the mapping
  9. On the warning dialog “The following keys have been reassigned…” click Continue Anyway

PowerToys Keyboard Manager application window

Docs for Keyboard Manager can be found here.

Conclusion

Remapping those keys has made my Windows experience easier. I’m going to remap the Caps Lock key to Right Arrow, to make it more convenient to exit keys and brackets when I’m coding.

If you disabled the Windows key and used to use the Search/Run box in the Start Menu to open things, I suggest installing Microsoft PowerToys and using its PowerToys Run utility. It’s mapped to Alt + Space by default and is similar to macOS’s Spotlight utility.

I like PowerToys Run more than the default Start Menu search, it’s faster and more accurate.

Reference


Tagged with windows keyboards software tech

784 words

  Reply via email