Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remap Caps Lock to Control on Windows 10

Ways to remap caps lock to control on Windows 10

These methods in this gist worked for me on my U.S.-based keyboard layouts. I am unsure about other layouts. If you have problems, revert your changes; delete the registry key you created (and reboot).

Update: you should probably scroll down to approach 4 where I suggest using Microsoft PowerToys Keyboard Manager.

Approach 1. Manually through regedit

Navigate to and create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout named Scancode Map.

You will enter the raw bytes like this (thanks @quapka):

00 00 00 00 00 00 00 00 02 00 00 00 1d 00 3a 00 00 00 00 00

Save. Reboot. Done.

Approach 2. Make your own registry key file.

Thanks @datsuka-qwerty

Create a new .reg file and name it something meaningful like capstoctrl.reg. Edit the file and paste in the following:

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,3a,00,00,00,00,00

Save. Run the file. Reboot. Done.

Approach 3. Through PowerShell (as Administrator)

Open PowerShell as an administrator (Win + X)

$hexified = "00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00".Split(',') | % { "0x$_"};

$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout';

New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified);

Save. Reboot. Done.

Approach 4. Microsoft PowerToys

Give PowerToys a try for remapping not only capslock, but other keys as well. Microsoft PowerToys: Utilities to customize Windows 10.

Microsoft PowerToys: Keyboard Manager enables you to redefine keys on your keyboard.

@quapka
Copy link

quapka commented Mar 28, 2020

For the non-Windowsy people like me. Once you create the new binary value called "Scancode Map" just enter the raw bytes:

00 00 00 00 00 00 00 00 02 00 00 00 1d 00 3a 00 00 00 00 00

@xnzac
Copy link

xnzac commented Oct 20, 2020

PowerShell running as admin works like a charm! Thanks for sharing.

@datsuka-qwerty
Copy link

datsuka-qwerty commented Jan 14, 2021

I made a reg file for my lazy self.

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,3a,00,00,00,00,00

@haolly
Copy link

haolly commented Jan 20, 2021

If anyone wants to revert/undo this change like me, just delete the registry key, and then restart PC.

@emil-andersen
Copy link

emil-andersen commented Jan 31, 2021

hey maybe a dumb question, how do we do the opposite? My keyboard just had a life on its own

@joshschmelzle
Copy link
Author

joshschmelzle commented Jan 31, 2021

@emil-andersen - try deleting the registry key you created and restart.

@oatberry
Copy link

oatberry commented Jun 30, 2021

PowerToys is very cool, thanks for this!!

@joshschmelzle
Copy link
Author

joshschmelzle commented Jul 12, 2021

anyone know what could be the issue for different binary for same windows10?

I think the differences in the hex you listed are because that also includes remapping the esc key which this gist does not cover.

If raerav's approach doesn't do what you need, I suggest remapping with PowerToys before wasting too much time on it.

https://docs.microsoft.com/en-us/windows/powertoys/

@khanhicetea
Copy link

khanhicetea commented Sep 18, 2021

Approach 3. Through PowerShell (as Administrator) is the best way

It's better than PowerToys, in some programs, it can detect Capslock is pressed, like you can try 2 methods in https://en.key-test.ru/

@qisoster
Copy link

qisoster commented Feb 20, 2022

How about remapping the 'CapsLock' key to 'Shift' instead of 'Control'? Thanks.

@joshschmelzle
Copy link
Author

joshschmelzle commented Feb 20, 2022

@joshschmelzle
Copy link
Author

joshschmelzle commented Feb 20, 2022

What @khanhicetea said is true though. PowerToys method does not work 100% of the time.

@khanhicetea
Copy link

khanhicetea commented Feb 21, 2022

@qisoster Try this (power shell method)

$hexified = "00,00,00,00,00,00,00,00,02,00,00,00,1d,00,2a,00,00,00,00,00".Split(',') | % { "0x$_"};

$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout';

New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified);

Explained here : https://renenyffenegger.ch/notes/Windows/registry/tree/HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control/Keyboard-Layout/index

Note: I changed 3a to 2a because 2a is hex code of Uncaps_Shift

@kittywitch
Copy link

kittywitch commented May 19, 2022

The example provided that is a registry file omits the

Windows Registry Editor Version 5.00

parts of the file. This makes it not work verbatim. The user who posted it even included that section. Please include it.

@joshschmelzle
Copy link
Author

joshschmelzle commented May 19, 2022

@kittywitch thanks for catching that. I updated the gist.

@xianmin
Copy link

xianmin commented May 24, 2022

Swap CapsLock & Ctrl :

$hexified = "00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,3a,00,1d,00,00,00,00,00".Split(',') | % { "0x$_"};

$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout';

New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified);

@van-latimer-radialrad
Copy link

van-latimer-radialrad commented Oct 3, 2022

I tried approach 3. It worked for a couple minutes, and now all the sudden caps lock does nothing. What could have gone wrong?

@avlm
Copy link

avlm commented Oct 3, 2022

PowerToys worked pretty fine for me! thanks!

@nosrednayduj
Copy link

nosrednayduj commented Oct 8, 2022

Powertoys did not allow remapping of caps lock to "just control". It prompted me to add another key to the sequence after I selected Ctrl.

@van-latimer-radialrad
Copy link

van-latimer-radialrad commented Oct 14, 2022

@nosrednayduj once you select ctrl, in the next box that opens up, scroll all the way to the top and select 'None'.

@pythonincloud
Copy link

pythonincloud commented Oct 21, 2022

The above solutions left me without an option to use the CapsLock itself.
This is a reg file to remap CapsLock to CTRL and CTRL ot CapsLock.

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,3a,00,3a,00,1d,00,00,00,00,00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment