Keyboard Scan Codes
When keys on a keyboard are pressed they send a number that can be interpretted by the computer. They are called
Scan Codes.
The below table lists all the
scan codes returned when keys or cominations of keys are pressed on a
101-key enhanced U.S.
keyboard.
Return codes listed here are in decimal.
| Key |
Alone |
Shift |
Ctrl |
Alt |
| Esc | 1 | 1 | 1 | 1 |
| 1 and ! | 2 | 2 | | 120 |
| 2 and @ | 3 | 3 | 3 | 121 |
| 3 and # | 4 | 4 | | 122 |
| 4 and $ | 5 | 5 | | 123 |
| 5 and % | 6 | 6 | | 124 |
| 6 and ^ | 7 | 7 | 7 | 125 |
| 7 and & | 8 | 8 | | 126 |
| 8 and * | 9 | 9 | | 127 |
| 9 and ( | 10 | 10 | | 128 |
| 0 and ) | 11 | 11 | | 129 |
| - and _ | 12 | 12 | 12 | 130 |
| = and + | 13 | 13 | | 131 |
| Backspace | 14 | 14 | 14 | 14 |
| Tab | 15 | 15 | 148 | 165 |
| Q | 16 | 16 | 16 | 16 |
| W | 17 | 17 | 17 | 17 |
| E | 18 | 18 | 18 | 18 |
| R | 19 | 19 | 19 | 19 |
| T | 20 | 20 | 20 | 20 |
| Y | 21 | 21 | 21 | 21 |
| U | 22 | 22 | 22 | 22 |
| I | 23 | 23 | 23 | 23 |
| O | 24 | 24 | 24 | 24 |
| P | 25 | 25 | 25 | 25 |
| [ and { | 26 | 26 | 26 | 26 |
| ] and } | 27 | 27 | 27 | 27 |
| Enter | 28 | 28 | 28 | 28 |
| A | 30 | 30 | 30 | 30 |
| S | 31 | 31 | 31 | 31 |
| D | 32 | 32 | 32 | 32 |
| F | 33 | 33 | 33 | 33 |
| G | 34 | 34 | 34 | 34 |
| H | 35 | 35 | 35 | 35 |
| J | 36 | 36 | 36 | 36 |
| K | 37 | 37 | 37 | 37 |
| L | 38 | 38 | 38 | 38 |
| ; and : | 39 | 39 | | 39 |
| ' and " | 40 | 40 | | 40 |
| ` and ˜ | 41 | 41 | | 41 |
| \ and | | 43 | 43 | 43 | 43 |
| Z | 44 | 44 | 44 | 44 |
| X | 45 | 45 | 45 | 45 |
| C | 46 | 46 | 46 | 46 |
| V | 47 | 47 | 47 | 47 |
| B | 48 | 48 | 48 | 48 |
| N | 49 | 49 | 49 | 49 |
| M | 50 | 50 | 50 | 50 |
| , and < | 51 | 51 | | 51 |
| . and > | 52 | 52 | | 52 |
| / and ? | 53 | 53 | | 53 |
| Space | 57 | 57 | 57 | 57 |
| F1 | 59 | 84 | 94 | 104 |
| F2 | 60 | 85 | 95 | 105 |
| F3 | 61 | 86 | 96 | 106 |
| F4 | 62 | 87 | 97 | 107 |
| F5 | 63 | 88 | 98 | 108 |
| F6 | 64 | 89 | 99 | 109 |
| F7 | 65 | 90 | 100 | 110 |
| F8 | 66 | 91 | 101 | 111 |
| F9 | 67 | 92 | 102 | 112 |
| F10 | 68 | 93 | 103 | 113 |
| F11 | 133 | 135 | 137 | 139 |
| F12 | 134 | 136 | 138 | 140 |
| NumPad Asterisk | 55 | 55 | 150 | 55 |
| NumPad Home | 71 | 71 | 119 | 151 |
| NumPad Arrow Up | 72 | 72 | 141 | 152 |
| NumPad PgUp | 73 | 73 | 132 | 153 |
| NumPad Minus | 74 | 74 | 142 | 74 |
| NumPad Arrow Left | 75 | 75 | 115 | 155 |
| NumPad NumPad 5 | 76 | 76 | 143 | |
| NumPad Arrow Right | 77 | 77 | 116 | 157 |
| NumPad Plus | 78 | 78 | 144 | 78 |
| NumPad End | 79 | 79 | 117 | 159 |
| NumPad Arrow Down | 80 | 80 | 145 | 160 |
| NumPad PgDn | 81 | 81 | 118 | 161 |
| Insert | 82 | 82 | 146 | 162 |
| Delete | 83 | 83 | 147 | 163 |
| NumPad / | 224 | 224 | 149 | 164 |
| NumPad Enter | 224 | 224 | 224 | 166 |