Skip to content

Instantly share code, notes, and snippets.

@xmaxrayx
Forked from ryanmoralesaz/scancodes.txt
Created July 9, 2026 20:27
Show Gist options
  • Select an option

  • Save xmaxrayx/d44bdc03f6b1b195928f310c0fcadf8d to your computer and use it in GitHub Desktop.

Select an option

Save xmaxrayx/d44bdc03f6b1b195928f310c0fcadf8d to your computer and use it in GitHub Desktop.
All ANSI keyboard Scan Codes for AHK
<!-- # AutoHotkey Scan Codes Reference Table -->
## Letter Keys
| Key | Scan Code | Key | Scan Code | Key | Scan Code |
| --- | --------- | --- | --------- | --- | --------- |
| A | SC01E | J | SC024 | S | SC01F |
| B | SC030 | K | SC025 | T | SC014 |
| C | SC02E | L | SC026 | U | SC016 |
| D | SC020 | M | SC032 | V | SC02F |
| E | SC012 | N | SC031 | W | SC011 |
| F | SC021 | O | SC018 | X | SC02D |
| G | SC022 | P | SC019 | Y | SC015 |
| H | SC023 | Q | SC010 | Z | SC02C |
| I | SC017 | R | SC013 | | |
## Number Row Keys
| Key | Scan Code | Key | Scan Code |
| --- | --------- | --- | --------- |
| 1 | SC002 | 6 | SC007 |
| 2 | SC003 | 7 | SC008 |
| 3 | SC004 | 8 | SC009 |
| 4 | SC005 | 9 | SC00A |
| 5 | SC006 | 0 | SC00B |
## Symbol Keys (Top Row)
| Key | Scan Code | Description |
| --- | --------- | ---------------- |
| ` | SC029 | Grave/Tilde |
| - | SC00C | Minus/Underscore |
| = | SC00D | Equals/Plus |
## Punctuation Keys
| Key | Scan Code | Description |
| --- | --------- | ------------- |
| [ | SC01A | Left Bracket |
| ] | SC01B | Right Bracket |
| \ | SC02B | Backslash |
| ; | SC027 | Semicolon |
| ' | SC028 | Apostrophe |
| , | SC033 | Comma |
| . | SC034 | Period |
| / | SC035 | Forward Slash |
## Function Keys
| Key | Scan Code | Key | Scan Code | Key | Scan Code |
| --- | --------- | --- | --------- | --- | --------- |
| F1 | SC03B | F5 | SC03F | F9 | SC043 |
| F2 | SC03C | F6 | SC040 | F10 | SC044 |
| F3 | SC03D | F7 | SC041 | F11 | SC057 |
| F4 | SC03E | F8 | SC042 | F12 | SC058 |
## Control Keys
| Key | Scan Code | Description |
| --------- | --------- | ------------- |
| Esc | SC001 | Escape |
| Tab | SC00F | Tab |
| Caps Lock | SC03A | Caps Lock |
| Shift (L) | SC02A | Left Shift |
| Shift (R) | SC136 | Right Shift |
| Ctrl (L) | SC01D | Left Control |
| Ctrl (R) | SC11D | Right Control |
| Alt (L) | SC038 | Left Alt |
| Alt (R) | SC138 | Right Alt |
| Space | SC039 | Spacebar |
| Enter | SC01C | Enter/Return |
| Backspace | SC00E | Backspace |
## Windows Keys
| Key | Scan Code | Description |
| ---- | --------- | -------------------- |
| LWin | SC15B | Left Windows Key |
| RWin | SC15C | Right Windows Key |
| Menu | SC15D | Menu/Application Key |
## Arrow Keys
| Key | Scan Code | Description |
| ----- | --------- | ----------- |
| Up | SC148 | Up Arrow |
| Down | SC150 | Down Arrow |
| Left | SC14B | Left Arrow |
| Right | SC14D | Right Arrow |
## Navigation Keys
| Key | Scan Code | Description |
| --------- | --------- | ----------- |
| Insert | SC152 | Insert |
| Delete | SC153 | Delete |
| Home | SC147 | Home |
| End | SC14F | End |
| Page Up | SC149 | Page Up |
| Page Down | SC151 | Page Down |
## Numpad Keys
| Key | Scan Code | Key | Scan Code | Key | Scan Code |
| ----- | --------- | ----- | --------- | ----- | --------- |
| Num 0 | SC052 | Num 4 | SC04B | Num 8 | SC048 |
| Num 1 | SC04F | Num 5 | SC04C | Num 9 | SC049 |
| Num 2 | SC050 | Num 6 | SC04D | Num + | SC04E |
| Num 3 | SC051 | Num 7 | SC047 | Num - | SC04A |
## Additional Numpad Keys
| Key | Scan Code | Description |
| --------- | --------- | --------------- |
| Num Lock | SC045 | Num Lock |
| Num / | SC135 | Numpad Divide |
| Num \* | SC037 | Numpad Multiply |
| Num . | SC053 | Numpad Decimal |
| Num Enter | SC11C | Numpad Enter |
## Special Keys
| Key | Scan Code | Description |
| ------------ | --------- | ------------ |
| Print Screen | SC137 | Print Screen |
| Scroll Lock | SC046 | Scroll Lock |
| Pause | SC045 | Pause/Break |
## Usage Notes
- In AutoHotkey, use these scan codes with the `SC` prefix (e.g., `SC02C` for Z)
- Scan codes are hardware-based and work regardless of keyboard layout
- Some extended keys use scan codes with more than 3 digits (like SC148 for Up Arrow)
- Right-side modifier keys often have scan codes starting with `1` (like SC11D for Right Ctrl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment