Skip to content
ASCII World

ASCII Keyboard Reference

Every key on a standard US keyboard maps to one or two ASCII values depending on whether Shift is held. Pressing the A key sends ASCII 97 (lowercase a). Hold Shift and it sends 65 (uppercase A). The difference between any uppercase and lowercase letter is always exactly 32, a single bit flip at position 5 in the binary representation. This was a deliberate hardware optimization from the 1963 ASA committee.

The keyboard itself does not generate ASCII codes. It sends scancodes that identify the physical key position. Scancode 0x1E fires whether your layout is QWERTY, AZERTY, or Dvorak. The operating system's keyboard driver translates scancodes into character codes based on the active layout and modifier state.

The Ctrl key works by clearing bits 5 and 6 of the character code, mapping letters tocontrol characters 0 through 31. Ctrl+A produces SOH (1), Ctrl+Z produces SUB (26). This bitmask trick is why the 26 Ctrl+letter combinations map directly to the first 26 control characters.

Letter Keys (A-Z)

Each letter key produces two ASCII values. Lowercase occupies positions 97-122, uppercase 65-90. Toggle case by adding or subtracting 32. In binary, bit 5 (value 32) is the only difference betweenA (1000001) anda (1100001).

KeyUpperDecHexLowerDecHex
A / aA650x41a970x61
B / bB660x42b980x62
C / cC670x43c990x63
D / dD680x44d1000x64
E / eE690x45e1010x65
F / fF700x46f1020x66
G / gG710x47g1030x67
H / hH720x48h1040x68
I / iI730x49i1050x69
J / jJ740x4Aj1060x6A
K / kK750x4Bk1070x6B
L / lL760x4Cl1080x6C
M / mM770x4Dm1090x6D
N / nN780x4En1100x6E
O / oO790x4Fo1110x6F
P / pP800x50p1120x70
Q / qQ810x51q1130x71
R / rR820x52r1140x72
S / sS830x53s1150x73
T / tT840x54t1160x74
U / uU850x55u1170x75
V / vV860x56v1180x76
W / wW870x57w1190x77
X / xX880x58x1200x78
Y / yY890x59y1210x79
Z / zZ900x5Az1220x7A

Digit Keys and Their Shifted Symbols

Digits 0-9 occupy ASCII positions 48-57. Subtract 48 from any digit's ASCII code to get its numeric value. Each digit key also produces a symbol when Shift is held. This mapping is specific to the US QWERTY layout. UK keyboards put the double quote on Shift+2 instead of @.

KeyNormalDecHexShiftedDecHex
0 / )0480x30)410x29
1 / !1490x31!330x21
2 / @2500x32@640x40
3 / #3510x33#350x23
4 / $4520x34$360x24
5 / %5530x35%370x25
6 / ^6540x36^940x5E
7 / &7550x37&380x26
8 / *8560x38*420x2A
9 / (9570x39(400x28

Punctuation and Symbol Keys

The remaining punctuation keyseach produce two ASCII characters. Brackets, braces, backslash, semicolon, quotes, and the comma/period/slash cluster all follow the same normal/shifted pattern.

KeyNormalDecHexShiftedDecHex
` / ~`960x60~1260x7E
- / _-450x2D_950x5F
= / +=610x3D+430x2B
[ / {[910x5B{1230x7B
] / }]930x5D}1250x7D
\ / |\920x5C|1240x7C
; / :;590x3B:580x3A
' / "'390x27"340x22
, / <,440x2C<600x3C
. / >.460x2E>620x3E
/ / ?/470x2F?630x3F

Whitespace Keys

Three keyboard keys produce whitespace characters. Space (32)is the only one with a visible gap on screen. Tab (9) advances to the next tab stop. Enter produces either CR, LF, or CR+LF depending on the platform and terminal mode.

KeyASCII NameDecHex
SpaceSP (Space)320x20
TabHT (Horizontal Tab)90x09
EnterCR (Carriage Return)130x0D
Enter (Unix)LF (Line Feed)100x0A

Ctrl Key Combinations

Holding Ctrl while pressing a key clears bits 5 and 6 of the ASCII value. This maps Ctrl+A through Ctrl+Z to control characters 1 through 26. Several of these have modern terminal functions: Ctrl+C sends SIGINT (interrupt), Ctrl+D sends EOF, Ctrl+Z sends SIGTSTP (suspend). The rest are mostly vestigial teletype codes.

CombinationDecHexNameFunction
Ctrl+@00x00NULNull character, C string terminator
Ctrl+A10x01SOHStart of Heading
Ctrl+B20x02STXStart of Text
Ctrl+C30x03ETXEnd of Text / terminal interrupt (SIGINT)
Ctrl+D40x04EOTEnd of Transmission / Unix EOF
Ctrl+E50x05ENQEnquiry
Ctrl+F60x06ACKAcknowledge
Ctrl+G70x07BELBell / terminal beep (\a)
Ctrl+H80x08BSBackspace
Ctrl+I90x09HTHorizontal Tab (same as Tab key)
Ctrl+J100x0ALFLine Feed / Unix newline
Ctrl+K110x0BVTVertical Tab
Ctrl+L120x0CFFForm Feed / clear terminal screen
Ctrl+M130x0DCRCarriage Return (same as Enter)
Ctrl+N140x0ESOShift Out
Ctrl+O150x0FSIShift In
Ctrl+P160x10DLEData Link Escape
Ctrl+Q170x11DC1XON / resume serial transmission
Ctrl+R180x12DC2Device Control 2
Ctrl+S190x13DC3XOFF / pause serial transmission
Ctrl+T200x14DC4Device Control 4
Ctrl+U210x15NAKNegative Acknowledge
Ctrl+V220x16SYNSynchronous Idle / terminal literal next
Ctrl+W230x17ETBEnd of Transmission Block
Ctrl+X240x18CANCancel
Ctrl+Y250x19EMEnd of Medium
Ctrl+Z260x1ASUBSubstitute / Unix suspend (SIGTSTP)
Ctrl+[270x1BESCEscape (same as Esc key)
Ctrl+\280x1CFSFile Separator / terminal quit (SIGQUIT)
Ctrl+]290x1DGSGroup Separator / telnet escape
Ctrl+^300x1ERSRecord Separator
Ctrl+_310x1FUSUnit Separator

Special Keys

These keys produce ASCII control characters but have dedicated physical keys rather than requiring the Ctrl modifier. Backspace and Delete are frequently confused because terminal emulators map them inconsistently. Check your terminal's configuration if pressing Backspace produces ^? instead of erasing the character.

KeyDecHexNameNote
Backspace80x08BSSome terminals send DEL (127) instead
Delete1270x7FDELHistorically erased paper tape by punching all 7 bits
Escape270x1BESCStarts ANSI escape sequences for terminal formatting
Tab90x09HTAdvances cursor to the next tab stop (every 8 columns)

Keys That Send Escape Sequences

Arrow keys, function keys, Home, End, and other navigation keys have no single ASCII code. Instead, they send multi-byte ANSI escape sequences based on the VT100 terminal standard (DEC, 1978). Every sequence starts with ESC (27), followed by one or more ASCII bytes that identify the key.

KeySequence
Up ArrowESC [ A
Down ArrowESC [ B
Right ArrowESC [ C
Left ArrowESC [ D
HomeESC [ H
EndESC [ F
InsertESC [ 2 ~
Page UpESC [ 5 ~
Page DownESC [ 6 ~
F1ESC O P
F2ESC O Q
F3ESC O R
F4ESC O S
F5ESC [ 1 5 ~
F12ESC [ 2 4 ~

Platform Differences

The same physical key can produce different ASCII codes depending on the operating system and terminal configuration. These differences cause real bugs, especially with line endings and the Backspace/Delete confusion.

KeyWindowsmacOSLinux
EnterCR+LF (13, 10)LF (10)LF (10)
BackspaceBS (8)DEL (127)DEL (127) or BS (8)
DeleteESC [ 3 ~ESC [ 3 ~ESC [ 3 ~
Ctrl+ZSUB (26) / EOF markerSUB (26) / SIGTSTPSUB (26) / SIGTSTP
Special charsALT codes via numpadOption key combinationsCompose key sequences

On Windows, ALT codes let you type any character from the active code page by holding ALT and typing the decimal value on the numeric keypad. ALT+65 produces A, ALT+130 produces the accented e fromCode Page 437. Adding a leading zero (ALT+0233) uses the Windows-1252code page instead.

Keys With No ASCII Representation

Several keyboard keys exist entirely outside the ASCII character set. They produce hardware scancodes or OS-level keycodes but never generate an ASCII byte. Applications that read raw ASCII input (like serial terminal programs) cannot detect these keys at all.

KeyWhat It SendsUsed By
Windows / SuperOS-level keycode onlyStart menu, window management shortcuts
Command (Mac)OS-level keycode onlyApplication shortcuts (Cmd+C, Cmd+V)
Alt / OptionModifier flag, no ASCII output aloneMenu access (Windows), special chars (Mac)
Caps LockScancode toggle, no ASCII outputShifts letter case state persistently
Num LockScancode toggle, no ASCII outputSwitches numpad between numbers and navigation
Scroll LockScancode toggle, no ASCII outputLegacy terminal scrollback, largely unused
Print ScreenOS-level event onlyScreenshot capture
Pause / BreakScancode only (E1 1D 45)Debugging, legacy DOS pause
Volume / Media keysHID usage codes via USBOS media controls, not visible to applications

Frequently Asked Questions

What ASCII code does the Enter key send?
It depends on the platform. On macOS and Linux, Enter sends LF (line feed, decimal 10). On Windows, Enter sends CR followed by LF (decimal 13 then 10). In raw terminal mode on Unix, Enter sends CR (decimal 13) and the terminal driver translates it to LF. Serial terminals historically sent CR only. This inconsistency dates back to the 1960s when teletypes needed both a carriage return (move the print head left) and a line feed (advance the paper) as separate mechanical operations.
Why do Ctrl+C and Ctrl+V have ASCII codes but no visible characters?
Ctrl+C produces ETX (End of Text, decimal 3) and Ctrl+V produces SYN (Synchronous Idle, decimal 22). These are control characters from the original 1963 ASCII standard, designed for teletype communication. The copy/paste shortcuts came decades later when graphical operating systems repurposed Ctrl combinations for application commands. The terminal still receives the original ASCII control code. That is why pressing Ctrl+C in a terminal sends SIGINT (interrupt signal) instead of copying text - the terminal interprets ETX as an interrupt before any application sees it.
How do arrow keys work if they have no ASCII code?
Arrow keys send multi-byte ANSI escape sequences, not single ASCII values. Pressing the up arrow sends three bytes: ESC (27), then the bracket character [ (91), then the letter A (65). Down is ESC [ B, right is ESC [ C, left is ESC [ D. The terminal emulator generates these sequences based on the VT100 standard from 1978. Function keys work the same way but with longer sequences. Programs like vim and bash parse these byte sequences to detect which key was pressed.
What is the difference between a scancode and an ASCII code?
A scancode identifies the physical key position on the keyboard. ASCII codes represent characters. When you press the A key, the keyboard controller sends scancode 0x1E to the computer. The operating system then translates that scancode into ASCII 65 (uppercase A) or 97 (lowercase a) depending on Shift and Caps Lock state. Scancodes are hardware-level and layout-dependent. The same physical key sends the same scancode regardless of whether your layout is QWERTY, AZERTY, or Dvorak. The OS keyboard driver handles the mapping from scancode to character code.