Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Appendix E: The ASCII character set

The American Standard Code for Information Interchange (ASCII) was invented in 1963, and after some development settled down in 1984 as standard X3.4 of American National Standards Institute (ANSI). It represents the 95 codes for the printable characters (A-Z, a-z, 0-9, and punctuation) of the unaccented Latin alphabet, plus 33 internal ‘control characters’ originally intended for the control of computers, programs, and external devices like printers, screens, disks, modems, etc.

Many other character sets (strictly speaking, ‘character repertoires’) have been used for accented Latin characters and for other (non-Latin) writing systems, for representing the symbols people use when writing text on computers, but the current standard is ISO 10646 (Unicode), which covers pretty much all the marks the human race makes when communication, and I strongly recommend you use only Unicode UTF-8 when writing for LATEX.

However, most programs and computers use ASCII internally for all their coding, the exceptions being XML-based languages like XSLT, which default to UTF-8, but are inherently designed to be usable with any writing system; and a few specialist systems like APL.

Although the TEX and LATEX file formats can easily be used with many other encoding systems (see the discussion of the inputenc package in § 1.8), their markup is based on ASCII. It is therefore important that you know where to find all 95 of the printable characters, as some of them are not often used in other text-formatting systems. The following table shows all 128 characters, with their decimal, octal (base-8), and hexadecimal (base-16) code numbers.

Table E.1: The ASCII characters

'00↑NUL 0SOH 1STX 2ETX 3EOT 4ENQ 5ACK 6BEL 7''0↑
'01↑BS 8HT 9LF 10VT 11FF 12CR 13SO 14SI 15''0↓
'02↑DLE 16DC1 17DC2 18DC3 19DC4 20NAK 21SYN 22ETB 23''1↑
'03↑CAN 24EM 25SUB 26ESC 27FS 28GS 29RS 30US 31''1↓
'04↑32! 33" 34# 35$ 36% 37& 38' 39''2↑
'05↑( 40) 41* 42+ 43, 44- 45. 46/ 47''2↓
'06↑0 481 492 503 514 525 536 547 55''3↑
'07↑8 569 57: 58; 59< 60= 61> 62? 63''3↓
'10↑@ 64A 65B 66C 67D 68E 69F 70G 71''4↑
'11↑H 72I 73J 74K 75L 76M 77N 78O 79''4↓
'12↑P 80Q 81R 82S 83T 84U 85V 86W 87''5↑
'13↑X 88Y 89Z 90[ 91\ 92] 93^ 94_ 95''5↓
'14↑` 96a 97b 98c 99d 100e 101f 102g 103''6↑
'15↑h 104i 105j 106k 107l 108m 109n 110o 111''6↓
'16↑p 112q 113r 114s 115t 116u 117v 118w 119''7↑
'17↑x 120y 121z 122{ 123| 124} 125~ 126DEL 127''7↓

Decimal number values are under or beside each character. The index numbers in the first and last columns are for finding the octal (base-8) and hexadecimal (base-16) values respectively. Replace the arrow with the number or letter from the top row label of the column (if the arrow points up) or from the bottom row label of the column(if the arrow points down).

Example: The Escape character (ESC) is decimal 27; octal '033 (03 for the row, 3 for the number at the top of the column because the arrow points up), and hexadecimal "1B (1 for the row, B for the letter at the bottom of the column because the arrow points down).