Keyboard Scan Codes
At a Glance
A scan code is a number which is sent from the keyboard to the computer once a key has been pressed.
The table below contains the keyboard scan codes in decimal as well as in hexadecimal format.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Key | Code (hex) | Code (dec) |
ESC | 01 | 001 |
! or 1 | 02 | 002 |
@ or 2 | 03 | 003 |
# or 3 | 04 | 004 |
$ or 4 | 05 | 005 |
% or 5 | 06 | 006 |
^ or 6 | 07 | 007 |
& or 7 | 08 | 008 |
* or 8 | 09 | 009 |
( or 9 | 0A | 010 |
) or 0 | 0B | 011 |
_ or - | 0C | 012 |
+ or = | 0D | 013 |
LEFT | 0E | 014 |
TAB | 0F | 015 |
Q | 10 | 016 |
W | 11 | 017 |
E | 12 | 018 |
R | 13 | 019 |
T | 14 | 020 |
Y | 15 | 021 |
U | 16 | 022 |
I | 17 | 023 |
O | 18 | 024 |
P | 19 | 025 |
{ or [ | 1A | 026 |
} or ] | 1B | 027 |
ENTER | 1C | 028 |
CTRL | 1D | 029 |
A | 1E | 030 |
S | 1F | 031 |
D | 20 | 032 |
F | 21 | 033 |
G | 22 | 034 |
H | 23 | 035 |
J | 24 | 036 |
K | 25 | 037 |
L | 26 | 038 |
: or ; | 27 | 039 |
" or ' | 28 | 040 |
or ` | 29 | 041 |
LEFT SHIFT | 2A | 042 |
| or \ | 2B | 043 |
Key | Code (hex) | Code (dec) |
Z | 2C | 044 |
X | 2D | 045 |
C | 2E | 046 |
V | 2F | 047 |
B | 30 | 048 |
N | 31 | 049 |
M | 32 | 050 |
< or , | 33 | 051 |
> or . | 34 | 052 |
? or / | 35 | 053 |
RIGHT SHIFT | 36 | 054 |
PRTSC or * | 37 | 055 |
ALT | 38 | 056 |
SPACEBAR | 39 | 057 |
CAPSLOCK | 3A | 058 |
F1 | 3B | 059 |
F2 | 3C | 060 |
F3 | 3D | 061 |
F4 | 3E | 062 |
F5 | 3F | 063 |
F6 | 40 | 064 |
F7 | 41 | 065 |
F8 | 42 | 066 |
F9 | 43 | 067 |
F10 | 44 | 068 |
NUMLOCK | 45 | 069 |
SCROLL LOCK | 46 | 070 |
HOME or 7 | 47 | 071 |
UP or 8 | 48 | 072 |
PGUP or 9 | 49 | 073 |
- | 4A | 074 |
LEFT or 4 | 4B | 075 |
5 | 4C | 076 |
RIGHT or 6 | 4D | 077 |
+ | 4E | 078 |
END or 1 | 4F | 079 |
DOWN or 2 | 50 | 080 |
PGDN or 3 | 51 | 081 |
INS or 0 | 52 | 082 |
DEL or . | 53 | 083 |
F11 | 85 | 133 |
F12 | 86 | 134 |
| | |