Remap Caps Lock

The Caps Lock key on most PC keyboards is in the position where the Control key is on many other keyboards, and vice versa. This can make it difficult for programmers to use the "wrong" kind of keyboard.

This page describes how to RemapCapsLock on different keys in different OperatingSystems.

One really stupid thing about PeeCee keyboards is that manufacturers even realized that putting caps-lock on home row was a bad idea because people kept hitting it with the 'a' key. Did they move it? No, that would be too sensible. They carved a little piece of it off to leave a bigger gap. So now if I re-map a standard PC-10* keyboard so that left-control is in a sensible place, it is still harder to use than it should be. :(

Many people (the majority, clearly) feel that the placement of CTRL below the SHIFT key is a better location for it. However, the backspace key is way out of the way -- it would be better if the CAPSLOCK and backspace keys were swapped.

Unix, Console

If you have loadkeys (as you would under Linux), this should do the trick:
 loadkeys /usr/share/keymaps/i386/qwerty/emacs2.kmap.gz
To reset to the defaults (you may have to switch to another tty and back to undo ctrl-lock):
 loadkeys -d

Unix, KDE

For KDE 4, you can use the GUI. Go to System Settings -> Input Devices. On the left, select Keyboard. Select the third tab "Advanced". Select "Configure keyboard options". Expand the option "Caps Lock key behavior" and check "Make CapsLock an additional ESC".

Unix, X

Under Redhat 8.0, just enable the following line in /etc/X11/XF86Config

        Option      "XkbOptions"        "ctrl:swapcaps"

Replace "swapcaps" with "nocaps" to turn both keys into "Control."

With X, there are at least 2 different ways to remap the keys. One is using xmodmap. For example, man xmodmap shows how to swap the left control key and the CapsLock key:

 ! Swap Caps_Lock and Control_L
 remove Lock = Caps_Lock
 remove Control = Control_L
 keysym Control_L = Caps_Lock
 keysym Caps_Lock = Control_L
 add Lock = Caps_Lock
 add Control = Control_L                 

Many people don't want a CapsLock key at all. They can change the CapsLock key to a ControlKey? by using the following lines in xmodmap:

 clear Lock
 keycode 0x7e = Control_R
 add Control = Control_R         

Maybe you have to change the keycode 0x7e. You can find the keycodes with xev. I Furthermore, this only works if you don't have a right control key. I hope somebody has a solution which does not have this restriction.

This solution might be the easiest one. If you do not have a problem owning a dead key in your keyboard you might disable CapsLock at all:

 "remove lock = Caps_Lock"  (or just: "clear lock")

A better solution might be this sequence, which is keycode independent and does not remove existing control keys:

 remove Lock = Caps_Lock
 remove Control = Control_L
 keysym Caps_Lock = Control_L
 add Lock = Caps_Lock
 add Control = Control_L

Now, you can use another solution which uses xkb. For that, you will have to find the sybols directory on your unix system. There, you add a file which might be called 'ctrl' containing the following:

 // eliminate the caps lock key completely (replace with control)
 partial modifier_keys
 xkb_symbols "nocaps" {
     key <CAPS>  {  symbols[Group1]= [ Control_L ] };
     modifier_map  Control { <CAPS>, <LCTL> };

This eliminates the caps lock key if included in a keymap. We can do this by changing the file en_US:
 xkb_symbols "pc101" {
     include "ctrl(nocaps)"
     key <RALT> { [ Mode_switch,  Multi_key ] };

augment "us(pc101)" include "iso9995-3(basic101)"

modifier_map Mod3 { Mode_switch }; };

You can then add the keyboard using a line like:
 /usr/X11R6/lib/X11/xkb/xkbcomp -w 1 -R/usr/X11R6/lib/X11/xkb -xkm -m en_US keymap/xfree86 0:0

Now, unfortunately there are probably errors in the text above. Please correct and make it working for other systems than RedHat Linux.

From WhyNotUseEmacs:

Add the following to your Xmodmap (on many linuxes the default Xmodmap is located at /etc/X11/Xmodmap):

 clear lock
 add control = Caps_Lock

You can activate this in a already-running X using

 xmodmap /etc/X11/Xmodmap   # or whatever the name of your modmap file is.

This will turn your caps lock into a control key. You won't have a caps lock key anymore, so make sure caps lock is off when you do this. ;) -- KevinStone?

If you get stuck and find yourself without a control key use xev to find the keycode of your control and caps lock keys. Then use the following to restore the default config.
 remove Lock = Caps_Lock
 remove Control = Control_L
 keycode <keycodeofcontrol> = Control_L
 keycode <keycodeofcapslock> = Caps_Lock
 add Lock = Caps_Lock
 add Control = Control_L

Additional shortcut key

It is also possible to make the Caps_Lock a handy additional shourcut modifier, ie.:
 remove Lock = Caps_Lock
 keysym Caps_Lock = Meta_L

Now one can define shortcuts like <Caps Lock>+A.

Mac OS X (10.3 and below):

Mac OS X (10.4 and above):

Apple now allows switching the mapping of any modifier keys in the Keyboard section of the Keyboard & Mouse preference panel. Simply go there and click the Modifier Keys button to change the mapping (Apple specifically mentions this feature is for developers who use Control often; score another one for us programmers!)

If you want to remap Caps Lock to something other than Control, Option, Command, or nothing, then use the free program PCKeyboardHack: . Use the companion program KeyRemap4MacBook to remap keys other than Caps Lock, including remapping them to Caps Lock: .

Linux, on an Apple iBook:

MS Windows

There are shareware/freeware apps that allow you to fiddle with the keymappings. One that comes with source code is Ctrl2Cap from SysInternals (now only at the waybackmachine)

Windows 7 / Vista / XP / 2000:

Portable EXE to Remap Caps Lock key Without Rebooting (free source):

Windows NT / Windows 2000:

Another good general purpose remapping utility for NT/2000/XP is KeyTweak.

This is a good free tool for NT/2K/XP/2K3 Uses the .NET framework -RDoom

there is also a way without rebooting, but needs an external tool: (all solutions require reboot?)

Windows 95,98,ME:

Almost a year ago, I e-mailed Microsoft support and asked them how to do this in 2k. They sent me a Microsoft utility that can remap the keyboard, twiddling registry bits in the background, which seems a cleaner solution than ctrl2caps. Unfortunately, I can't remember the name of the app, and I no longer have the e-mail. -- RobertChurch

Was it this one?

No, that one works in Win 95/98 but not NT/2000.

Was it remapkey.exe?

I TOO used that simple util with registry bits ... it also had a .dll if I recall... now I am searching all over, in vain.

Supposedly, the RemapKey utility is now included with the Windows 2000 Resource Kit, and works with NT/2000/XP.

Now on MSDN, Microsoft Keyboard Layout Creator:

This program doesn't appear to allow you to assign either Caps Lock nor Control.

Win2k/XP: The following Microsoft web page describes how to add a registry entry to remap the keyboard's scan codes. This method is simple and works well.
Make a file named (for example) CapsLockIsCtrl.reg with these three lines:

 [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

Double click it from Windows explorer, reboot. That nasty CapsLock is gone! To put it on the Left-Ctrl key use SwapCtrlAndCapsLock.reg:

 [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

Once you get sick of fiddling around with arcane configuration files in various operating systems (or using utilities that do the same), you can always buy a keyboard with control where caps usually is:

I bought a HappyHackingKeyboard? (, but I'm not happy with it. There's a bunch of empty space in the bottom corners which could have been used to expand the painfully-small Alt keys. I also have weird mapping problems if I boot windows, since it has a different interpretation of the Alt/Meta keys than X. I much prefer a regular keyboard with nicely shaped keys (esp. ThinkPad) and a mercilessly customized xmodmap. -- LukeGorrie
See also: CapsLockOff
The cubicle police and their lackeys would forbid this and crack your knuckles for being a CompulsiveCustomizer.
Keep in mind, it's infuriating to use some else's keyboard when the keys labels aren't accurate. Don't remap if other people will be typing on your keyboard.

This last remark is disquieting. Are you perchance suggesting that some people find caps lock actually useful. DO THEY NEVER GET A SORE THROAT OF ALL THE SHOUTING?

Believe it or not, some people use their keyboards for purposes other than newsgroups and e-mail. I use Caps Lock a lot more than I use Control. I have to type things like "CORBA", "DCOM", ".NET", "MAX_INT", "#ifdef DEBUG", etc. quite a lot. The only time I use Control is when I have to use Emacs or when I need to kill a process in Unix. Believe it or not, that's why people switch it. Programmers use control very frequently, especially when using the EmacsEditor.

I don't think I ever use Caps Lock. If I need to type an ALLUPPERCASE word, I hold Shift with my left pinky. Q, A, and Z (or double-quote, A and colon on a DvorakKeyboard) are easy enough to type with the ring-finger. I think I may have picked up the habit from an editor I used to use which let you remap the keys (and I remapped it to Dvorak), but Caps Lock always affected the same keys (and so didn't work for S, W, V and Z, and had an unwanted effect on ["'<,>.:;])
Others use emacs exclusively, which renders CAPS_LOCK obsolete, due to the upcase-word and upcase-region functions (M-u and C-x C-u, respectively).

The best keyboard ever made, hands down, is the IBM Model M Keyboard (IBM part no. 1391401) with its heavy base and incredible tactile feel. However, it too suffers from the Caps Lock/Control swap design deficiency of the standard 10x-key layout, so these workarounds are a must. Or, you could order an Omnikey Customizer board from ; they sell new keyboards made to the original Model M specifications, and this particular model (sometimes referred to as "Linux 101") puts Control where it belongs - and as a bonus, also moves Escape to a location where it's far more accessible for touch typists. At $69 it's not cheap, but that's the same price as the Happy Hacking Keyboard Lite... and the HHK doesn't have the tactile response of a Model M.

Heh, I'm a model M fan too. I managed to dig up one of the original IBM PC/AT 84 key keyboards, which have the control key in the correct place. (But get the enter key wrong...) And it just so happens the keycaps are intercangeable, and of the exact size needed to fit on a Model M! So I have a Model M with the control correctly labled and in the right place, and doesn't even have the "bite" taken out of it. And caps lock is in the lower left.

But then I had the incredible luck to stumble upon a brand new IBM Model M15 ergonomic folding keyboard being thrown out! A clicky ergo keyboard, rock on! I didn't know these existed, and apparently most other Model M fans don't either. However it uses slightly different keycaps, also used by the Model M2, so I can't use properly labeled keycaps. On this one I ended up not only remapping caps lock to control, I switched the tilde keycap to where control was, (Control and alt are normal sized keys on these), the escape key to where tilde was, and the control keycap to where escape was. IBM put escape WAY off to the upper left on these. Yes, I am a Vim monkey... The duplicate arrow keys on the left side are kind of neat, but I wish I could remap them separately from the right. And the way the 'edit' keys were shoved into the upper right, far from the arrows is kind of annoying. Here's what an M15 looks like:

--- The Avant Prime and Avant Stellar keyboards have remappable keys ( The keyboards come with remapping software for Windows; doing it manually is feasible, but annoying. Even better, the keyboards come with extra keycaps for Control and Caps Lock, after you swap them. It's based on the Northgate Omnikey design, and the keyboard action is comparable to an Omnikey. Note that the Avant Stellar has function keys down the left hand side as well as across the top, and both have Windows keys (I use them to make Alt and Meta distinct modifiers under X11).
VimTextEditor users might want to remap caps lock to escape, to give them a more natural way to jump between modes. At any rate, there are few times when having caps lock on the home row is useful. Definitely a ZombieTechnology?.
I've found that the easiest way to remap Caps Lock to Control on Windows 2000/XP is to use the registry editor. You've got to insert a binary value to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet?\Control\Keyboard Layout\Scancode Map. I found (after a couple of tries) that the value "00 00 00 00 00 00 00 00 02 00 00 00 1D 00 3A 00 00 00 00 00" does quite well when you want to remap your Caps Lock as a "Left Control" -key. For further information:

If I had to type HKEY_LOCAL_MACHINE\SYSTEM\, I would use Caps Lock. ;-) -- BrianRogers

No need. It's easy to type HKEY_LOCAL_MACHINE\SYSTEM\ without Caps Lock. Just hold Shift with your left pinky and type the "A"s with your ring finger. You've got to use Shift to type the underscores anyway...

Or, with a KinesisKeyboard or other good keyboard, just do it in hardware (well, in the keyboard's firmware). Works with every OS, don't need to set it up on each new system. Personally, I like where Kinesis puts control, so I have caps lock mapped to expose.

Update, about two months later: I've now mapped caps lock to work as a shift key, and am using the shift key as expose... so shift (my most common non-text key) is just to the left of A, and expose is still accessible. -- AdamBerger

I, too, have no use for a CAPS LOCK key. On the other hand, I have always wanted a single key for switching layouts (e.g. Latin/Cyrillic). Having discovered MSKLC, I made a custom keymap that has Latin characters in normal mode and Cyrillic in Caps, and I can tell it's a big improvement over default Windows-provided Ctrl+Shift or Alt+Shift. As a bonus, it shows me the current layout with the Caps LED. -- YuriKhan?

Yes, CapsLock is a good switcher for keyboard layouts, so it has been default Latin/Cyrillic Cyrillic switch in some Unix-like OSes (at least in FreeBSD) for many years. Also, layout indicator on the keyboard itself - so now, the right use for CapsLock, no longer useless. -- VadimGoncharov?

I wish I had read this page sooner. Almost every keyboard I own has had it's caps lock key pried off. I just now put the key cap back on on my mac thanks to having discovered: MacOsX>UnderTheApple>SystemPreferences>KeyboardAndMouse>ModifierKeys>CapsLock>NoAction>OK !! -- ChrisGarrod

More on the subject of Capslock removal or rearranging can be found on AnticAPSLOCK (, a movement dedicated to getting rid of the key.

mAyBE tHIs iS noT sUCh A gOod ideA aFTeR alL. iT HaS sIDe efFeCts.

I use WinKeyPlus? ( to remap capslock and disable F1.
Try Karabiner ( on Mac OS X to bind the Return-key to a Control-key too. Any chance a similar software is found on Windows world? -- JonneItkonen

View edit of September 15, 2014 or FindPage with title or text search