I am in the process of remapping some keys on my Windows 7 keyboard.

I have done the following (in a .reg file):

[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 

I am interested in being able to remap other keys. However, I am having a heck of a time finding the specific scan codes to do this.

Is there a listing of these scan codes somewhere? I've spent a fair bit of time trying to find information and other than the caps/control I cannot seem to find them. I would like a listing of all scan codes - in a format which makes sense for remapping.

The specific keys I am interested in are:

  • 1
    Does this Microsoft link help you further?
    – nixda
    Feb 13, 2013 at 18:03
  • @nixda I've seen that but it does not provide the actual scan codes to use (as best I can tell)
    – enderland
    Feb 13, 2013 at 18:08
  • Mind that in my Windows 7 64 bit Pro, [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] is empty, no Scancode key there.
    – user274594
    Nov 16, 2013 at 13:08
  • 3
    BTW, FYI: on very few keyboards (other than Apple's) does the Fn/function key produce any scancode. Instead, when it is pressed in combination with certain other keys a certain, unique scancode is sent as if that other key was pressed alone instead of two keys. the pause key is the one key whose scancode can not be changed in the windows registry.
    – AuralArch
    Jun 10, 2019 at 19:32
  • Re "Function": the Fn key or function keys F1-12? Feb 5, 2023 at 3:42

4 Answers 4


UPDATE: I found a more complete list of scan codes:


Credits to it's author: Taran Van Hermit

I found this guide to help others understand how to remap keys using registry: https://isenselabs.com/posts/keyboard-key-kills-and-remaps-for-windows-users

But you already know how to do that, and you just need to have a list of scancodes, so here goes:

   SC Key   SC Key   SC Key        SC Key        SC Key       SC Key
            20 D     40 F6         60 Ctrl F3    80 Alt 9     A0 Alt Dn Arrow
   01 ESC   21 F     41 F7         61 Ctrl F4    81 Alt 0     A1 Alt PgDn
   02 1     22 G     42 F8         62 Ctrl F5    82 Alt -     A2 Alt Ins
   03 2     23 H     43 F9         63 Ctrl F6    82 Alt =     A3 Alt Del
   04 3     24 J     44 F10        64 Ctrl F7    84 Ctrl PgUp A4 Alt / (num)
   05 4     25 K     45 Num Lk     65 Ctrl F8    85 F11       A5 Alt Tab
   06 5     26 L     46 Scrl       66 Ctrl F9    86 F12       A6 Alt Enter
                        Lk                                       (num)
   07 6     27 ; :   47 Home       67 Ctrl F10   87 SH F11        
   08 7     28 ' "   48 Up Arrow   68 Alt F1     88 SH F12        
   09 8     29 ` ~   49 Pg Up      69 Alt F2     89 Ctrl F11      
   0A 9     2A L SH  4A - (num)    6A Alt F3     8A Ctrl F12      
   0B 0     2B \ |   4B 4 Left     6B Alt F4     8B Alt F11       
   0C - _   2C Z     4C 5 (num)    6C Alt F5     8C Alt F12       
   0D = +   2D X     4D 6 Rt Arrow 6D Alt F6     8C Ctrl Up       
   0E BKSP  2E C     4E + (num)    6E Alt F7     8E Ctrl -        
   0F Tab   2F V     4F 1 End      6F Alt F8     8F Ctrl 5        
   10 Q     30 B     50 2 Dn Arrow 70 Alt F9     90 Ctrl +        
   11 W     31 N     51 3 Pg Dn    71 Alt F10    91 Ctrl Dn       
   12 E     32 M     52 0 Ins      72 Ctrl PtScr 92 Ctrl Ins      
   13 R     33 , <   53 Del .      73 Ctrl L     93 Ctrl Del      
   14 T     34 . >   54 SH F1      74 Ctrl R     94 Ctrl Tab      
   15 Y     35 / ?   55 SH F2      75 Ctrl End   95 Ctrl /        
   16 U     36 R SH  56 SH F3      76 Ctrl PgDn  96 Ctrl *        
   17 I     37 PtScr 57 SH F4      77 Ctrl Home  97 Alt Home      
   18 O     38 Alt   58 SH F5      78 Alt 1      98 Alt Up        
   19 P     39 Spc   59 SH F6      79 Alt 2      99 Alt PgUp      
   1A [ {   3A CpsLk 5A SH F7      7A Alt 3      9A               
   1B ] }   3B F1    5B SH F8      7B Alt 4      9B Alt Left      
   1C Enter 3C F2    5C SH F9      7C Alt 5      9C               
   1D Ctrl  3D F3    5D SH F10     7D Alt 6      9D Alt Rt        
   1E A     3E F4    5E Ctrl F1    7E Alt 7      9E               
   1F S     3F F5    5F Ctrl F2    7F Alt 8      9F Alt End       

The keycode that you're going to use in registry consists of two parts for example: 4B E0 which is left arrow or 0F 00 which is Tab key, in the above list you will find the first part of the key code 4B for example, the second part usually is 00 or E0 I have no idea what the second part is and I couldn't find anything on it and I'm writing this out of my own findings, do some trial and error and you will find your key.

  • I'm extremely confused as to the how and where to input the number pairs. How do you know? Or does it not matter? Which of the 00 do you replace?
    – Tom
    May 10, 2020 at 8:55
  • It's very simple, ESC::A this code will type a every time you hit the escape key, if you want to use the scan code from my list, do this: SC01::A
    – Shayan
    May 10, 2020 at 11:40
  • I dont think that works @shayan. It needs to be in a hex form with two characters. Your answer is incorrect. After some digging I figured it out through sharpkeys anyway, they had a perfect answer already.
    – Tom
    May 12, 2020 at 12:12
  • That list doesn't contain all of the scan codes OP was asking for. It's missing the WIndows key, menu key, and possibly others.
    – Sparkette
    Jan 8, 2021 at 16:22

@fabianroling and anyone else who can't use third-party software: the Keyboard Scan Code Specification from Microsoft has the definitions for all the scan codes. It also says the following:

Under all Microsoft operating systems, all keyboards actually transmit Scan Code Set 2 values down the wire from the keyboard to the keyboard port. These values are translated to Scan Code Set 1 by the i8042 port chip. The rest of the operating system, and all applications that handle scan codes expect the values to be from Scan Code Set 1.

So, nothing Windows-specific, just standard Set 1 codes.

  • Yes, those are the lowest-level ones. But there is some confusion as to what "scan code" means. There are also some operating system-level ones. For example, some keys produce more than one scan code at the lowest level (e.g., the right Ctrl, two scan codes, 0xE0 and 0x14), whereas on the operating system level it is only one number. It is most likely a higher-level one that is to be used for this registry thingy. Feb 5, 2023 at 3:39

If you want to do it the easy way, you can simply use SharpKeys, KeyTweak or similar utilities.

If you're simply after scancodes, the same programs should be able to help:



  • 6
    This answer doesn't actually help anyone who isn't allowed to install third party software on the current computer (like me). If I was allowed to use this program to find out scancodes, I might as well just use the program to remap keys. Jan 16, 2019 at 7:01
  • While that is a frustrating situation to not be able to install programs, it is admittedly also odd if you have admin access, but can't install programs. Because the programs above do write to the registry key at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout" with a binary value named "Scancode Map". If you intend to do this as a "set and forget" thing, you could use Sharpkeys on a different system, and then export the registry key in question. Then you can import it on a different system (granted that things such as the keyboard layout are the same)
    – Testerhood
    Aug 26, 2023 at 15:08
  • The other alternative is that you can check out the source code of Sharpkeys, which has the relevant scan codes written inside this class file here: github.com/randyrants/sharpkeys/blob/master/SharpKeys/… Search for "Special: Left Windows" inside that code.
    – Testerhood
    Aug 26, 2023 at 15:11

AHK comes with built-in keyboard and mouse hooks, if that happens to be something you already use:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .