Knowledge

The Complete Guide to ASCII: History, Encoding Principles, and Full Character Table

A comprehensive guide to ASCII encoding — its origins, how it works, character classification, and the full lookup table. Understand control characters vs. printable characters and ASCII's role in modern computing. Includes an online ASCII converter tool.

In everyday programming and data processing, ASCII is one of the very first character encoding standards we encounter — and one of the most frequently used. Whether you’re naming variables in code, parsing network protocol messages, or debugging serial communication in embedded systems, ASCII is the bedrock of it all. This article covers everything from its historical origins to encoding principles, character classifications, and full lookup tables.

Need to convert between ASCII codes and text right now? Try our Online ASCII Converter, which supports decimal, binary, octal, and hexadecimal formats.

1. What is ASCII?

ASCII (American Standard Code for Information Interchange) is a character encoding system based on the Latin alphabet. First published in 1963 by the American Standards Association (ASA, later ANSI), it is the ancestor of all modern character encoding systems.

ASCII uses 7-bit binary numbers (ranging from 0000000 to 1111111) to represent 128 characters, including:

  • 33 control characters (non-printable, codes 0–31 and 127)
  • 95 printable characters (codes 32–126), covering English letters, Arabic numerals, punctuation marks, and various special symbols

Since 7 bits fit neatly into an 8-bit byte (with the high bit typically set to 0 or used for parity checking), ASCII is naturally aligned with the byte-based storage architecture of computers.

2. The History of ASCII

2.1 The Problem It Solved

Before the 1960s, different computer manufacturers defined their own character encodings. IBM used EBCDIC, telegraph systems used Baudot code, and these were mutually incompatible. This made cross-platform data exchange extremely difficult.

To create a unified standard, the American Standards Association (ASA) began work on ASCII in 1960. The ASA X3.4 standard — ASCII — was officially published in 1963.

2.2 Key Milestones

YearEvent
1963ASCII first published (ASA X3.4-1963) with 128 characters
1967Revised edition released, adding lowercase letters and other updates
1968U.S. federal government mandated ASCII support for all government computers
1986Final revision (ANSI X3.4-1986), the version still in use today
1991Unicode 1.0 released; ASCII becomes a subset of Unicode (U+0000 to U+007F)

2.3 From ASCII to Unicode

ASCII can only represent 128 characters — sufficient for English but unable to cover Chinese, Japanese, Korean, Arabic, and countless other writing systems. To meet globalization needs, various extended encodings were developed (ISO 8859 series, GBK, Shift-JIS, etc.), and eventually Unicode emerged as today’s universal character encoding standard.

Notably, ASCII is a proper subset of UTF-8 — any ASCII text is already valid UTF-8 text. This backward compatibility is one of the key reasons UTF-8 has been adopted so rapidly.

3. How ASCII Encoding Works

3.1 Binary Representation

Each ASCII character is represented by a 7-bit binary number, with values ranging from 0 to 127. Take the letter A as an example:

  • Decimal: 65
  • Binary: 1000001
  • Octal: 101
  • Hexadecimal: 41

3.2 Encoding Example

Let’s convert the word Hello to ASCII decimal codes:

CharacterHello
Decimal72101108108111
Hexadecimal48656C6C6F
Binary10010001100101110110011011001101111

So the ASCII decimal representation of Hello is 72 101 108 108 111.

You can verify this using our Online ASCII Converter, which supports bidirectional conversion between text and ASCII codes.

3.3 Clever Design Patterns

ASCII’s code assignments are far from arbitrary — they contain several elegant design choices:

  1. Uppercase and lowercase letters differ by 32: A = 65, a = 97 — the difference is exactly 32 (only bit 5 differs). This means you can convert case by flipping a single bit.
  2. Digit characters follow a pattern: 0 = 48 (0x30), 9 = 57 (0x39). Subtracting 48 (or '0') from a digit character gives you its numeric value.
  3. Letters are arranged consecutively: A–Z and a–z are contiguous in the encoding table, making iteration and arithmetic straightforward.
  4. Control characters come first: Codes 0–31 are reserved for control functions; printable characters start at 32.

4. ASCII Character Classification

4.1 Control Characters (0–31, 127)

Control characters do not display visible glyphs on screen. Instead, they control how text is processed. Here are some commonly encountered ones:

DecimalHexAbbr.NameDescription
000NULNullString terminator (C language \0)
707BELBellTriggers a terminal bell/beep
808BSBackspaceMoves cursor back one position
909HTHorizontal TabTab key (\t)
100ALFLine FeedNew line (\n), Unix/Linux line ending
130DCRCarriage ReturnReturn to start of line (\r), Windows uses CR+LF
271BESCEscapeStart of terminal escape sequences
1277FDELDeleteDelete character

Fun fact: The difference in line endings across operating systems is a classic headache. Unix/Linux uses LF (\n), Windows uses CR LF (\r\n), and classic Mac OS used CR (\r).

4.2 Printable Characters (32–126)

Printable characters are what we use most frequently — spaces, punctuation, digits, and letters.

Digits (48–57)

DecimalCharDecimalCharDecimalChar
480524568
491535579
502546
513557

Uppercase Letters (65–90)

DecimalCharDecimalCharDecimalChar
65A74J83S
66B75K84T
67C76L85U
68D77M86V
69E78N87W
70F79O88X
71G80P89Y
72H81Q90Z
73I82R

Lowercase Letters (97–122)

DecimalCharDecimalCharDecimalChar
97a106j115s
98b107k116t
99c108l117u
100d109m118v
101e110n119w
102f111o120x
103g112p121y
104h113q122z
105i114r

4.3 Complete ASCII Reference Table (0–127)

Here is the full set of all 128 standard ASCII characters:

Control Characters (0–31 and 127)

DecimalOctalHexBinaryAbbr.NameDescription
0000000000000NULNullString terminator (C language \0)
1001010000001SOHStart of HeadingData frame start marker
2002020000010STXStart of TextBody data start
3003030000011ETXEnd of TextBody data end
4004040000100EOTEnd of TransmissionTerminate transmission
5005050000101ENQEnquiryRequest response
6006060000110ACKAcknowledgeData received confirmation
7007070000111BELBellTriggers a terminal bell/beep
8010080001000BSBackspaceMoves cursor back one position
9011090001001HTHorizontal TabTab key (\t)
100120A0001010LFLine FeedNew line (\n), Unix/Linux line ending
110130B0001011VTVertical TabVertical tabulation
120140C0001100FFForm FeedNext page (\f)
130150D0001101CRCarriage ReturnReturn to start of line (\r)
140160E0001110SOShift OutSwitch to alternate character set
150170F0001111SIShift InSwitch back to original character set
16020100010000DLEData Link EscapeEscape control character
17021110010001DC1Device Control 1XON (resume transmission)
18022120010010DC2Device Control 2Device-specific control
19023130010011DC3Device Control 3XOFF (pause transmission)
20024140010100DC4Device Control 4Device-specific control
21025150010101NAKNegative AcknowledgeReject/error
22026160010110SYNSynchronous IdleSynchronization signal
23027170010111ETBEnd of Transmission BlockData block end marker
24030180011000CANCancelCancel current operation
25031190011001EMEnd of MediumData medium end
260321A0011010SUBSubstituteReplacement for unavailable character
270331B0011011ESCEscapeStart of terminal escape sequences
280341C0011100FSFile SeparatorFile separator
290351D0011101GSGroup SeparatorGroup separator
300361E0011110RSRecord SeparatorRecord separator
310371F0011111USUnit SeparatorUnit separator
1271777F1111111DELDeleteDelete character

Space and Punctuation (32–47)

DecimalOctalHexCharName
3204020 Space
3304121!Exclamation mark
3404222"Double quotation mark
3504323#Number sign
3604424$Dollar sign
3704525%Percent sign
3804626&Ampersand
3904727'Apostrophe
4005028(Left parenthesis
4105129)Right parenthesis
420522A*Asterisk
430532B+Plus sign
440542C,Comma
450552D-Hyphen-minus
460562E.Full stop
470572F/Slash

Digits (48–57)

DecimalOctalHexCharName
48060300Digit zero
49061311Digit one
50062322Digit two
51063333Digit three
52064344Digit four
53065355Digit five
54066366Digit six
55067377Digit seven
56070388Digit eight
57071399Digit nine

Punctuation (58–64)

DecimalOctalHexCharName
580723A:Colon
590733B;Semicolon
600743C<Less-than sign
610753D=Equals sign
620763E>Greater-than sign
630773F?Question mark
6410040@At sign

Uppercase Letters (65–90)

DecimalOctalHexCharName
6510141AUppercase A
6610242BUppercase B
6710343CUppercase C
6810444DUppercase D
6910545EUppercase E
7010646FUppercase F
7110747GUppercase G
7211048HUppercase H
7311149IUppercase I
741124AJUppercase J
751134BKUppercase K
761144CLUppercase L
771154DMUppercase M
781164ENUppercase N
791174FOUppercase O
8012050PUppercase P
8112151QUppercase Q
8212252RUppercase R
8312353SUppercase S
8412454TUppercase T
8512555UUppercase U
8612656VUppercase V
8712757WUppercase W
8813058XUppercase X
8913159YUppercase Y
901325AZUppercase Z

Brackets and Backtick (91–96)

DecimalOctalHexCharName
911335B[Left square bracket
921345C\Backslash
931355D]Right square bracket
941365E^Circumflex accent
951375F_Underscore
9614060`Grave accent (backtick)

Lowercase Letters (97–122)

DecimalOctalHexCharName
9714161aLowercase a
9814262bLowercase b
9914363cLowercase c
10014464dLowercase d
10114565eLowercase e
10214666fLowercase f
10314767gLowercase g
10415068hLowercase h
10515169iLowercase i
1061526AjLowercase j
1071536BkLowercase k
1081546ClLowercase l
1091556DmLowercase m
1101566EnLowercase n
1111576FoLowercase o
11216070pLowercase p
11316171qLowercase q
11416272rLowercase r
11516373sLowercase s
11616474tLowercase t
11716575uLowercase u
11816676vLowercase v
11916777wLowercase w
12017078xLowercase x
12117179yLowercase y
1221727AzLowercase z

Braces and Tilde (123–126)

DecimalOctalHexCharName
1231737B{Left curly bracket
1241747C``
1251757D}Right curly bracket
1261767E~Tilde

5. ASCII in Programming

5.1 Converting Between Characters and Codes

Most programming languages make it easy to convert between characters and their ASCII values:

JavaScript:

// Character → ASCII code
'A'.charCodeAt(0);  // 65

// ASCII code → Character
String.fromCharCode(65);  // 'A'

Python:

# Character → ASCII code
ord('A')  # 65

# ASCII code → Character
chr(65)  # 'A'

C:

// Characters are integers
char c = 'A';
int ascii = c;  // 65

// Integer to character
char ch = 65;  // 'A'

5.2 Case Conversion Tricks

Since uppercase and lowercase ASCII letters differ by exactly 32, you can use bitwise operations for efficient case conversion:

// To lowercase: set bit 5 to 1 (OR 32)
String.fromCharCode('A'.charCodeAt(0) | 32);  // 'a'

// To uppercase: set bit 5 to 0 (AND ~32)
String.fromCharCode('a'.charCodeAt(0) & ~32);  // 'A'

// Toggle case: flip bit 5 (XOR 32)
String.fromCharCode('A'.charCodeAt(0) ^ 32);  // 'a'

5.3 Data Validation and Protocols

Many network protocols (HTTP, SMTP, FTP) use ASCII text for commands and headers. Understanding ASCII helps you parse network messages, debug serial communication, and understand percent-encoding in URLs — like %20 (space) or %41 (A).

6. ASCII Extensions and Unicode

6.1 Limitations of ASCII

128 characters are barely enough for English, but they fall short when facing hundreds of languages and tens of thousands of writing systems worldwide:

  • Cannot represent accented European characters (é, ü, ñ)
  • Does not support CJK (Chinese, Japanese, Korean) characters
  • Lacks many mathematical and special symbols

6.2 Extended ASCII

To compensate, various vendors used the 8th bit (codes 128–255) to define “Extended ASCII” character sets:

  • ISO 8859-1 (Latin-1): Covers Western European languages
  • Windows-1252: Microsoft’s Western European character set
  • GB2312 / GBK: Chinese character encodings
  • Shift-JIS: Japanese character encoding

These extensions were mutually incompatible, leading to the infamous “mojibake” (garbled text) problem.

6.3 Unicode Unification

Unicode preserves ASCII’s 0–127 at U+0000 to U+007F and extends coverage to over 150,000 characters. UTF-8 is fully backward-compatible with ASCII: for characters in the ASCII range (0–127), UTF-8 uses the exact same single-byte encoding. This is why UTF-8 has become the default encoding for most modern systems.

7. ASCII Art

ASCII art is the practice of creating images and patterns using ASCII printable characters. In the early days of computing and BBS (Bulletin Board Systems), ASCII art was one of the primary ways to display graphics.

  /\_/\
 ( o.o )
  > ^ <
 /|   |\
(_|   |_)

ASCII art remains alive and well in programmer culture today — many command-line tools and open-source projects display carefully designed ASCII logos on startup.

8. Frequently Asked Questions

Q1: What is the relationship between ASCII and Unicode?

ASCII is a subset of Unicode. The first 128 code points of Unicode (U+0000 to U+007F) are identical to ASCII.

Q2: How many characters does ASCII have?

Standard ASCII defines 128 characters (7-bit, 0–127): 33 control characters and 95 printable characters.

Q3: Does ASCII support Chinese characters?

No. Chinese characters are outside the standard ASCII range. Chinese text uses extended character sets (like GBK or GB18030) or Unicode encoding.

Q4: Why does ASCII use 7 bits instead of 8?

At the time of its design, 7 bits were sufficient to cover all characters needed for English. The 8th bit was reserved for parity checking (error detection in data transmission) and was later repurposed by various extended encodings.

Q5: What is the “printable” range of ASCII values?

Characters from decimal 32 to 126 are printable, including the space (32) and tilde ~ (126).

9. Conclusion

Despite having only 128 characters, ASCII is the cornerstone of the entire digital world. Understanding ASCII encoding helps you work more effectively with string processing, network protocols, and file encodings — and makes debugging character encoding issues far less painful.

Want to convert ASCII codes quickly? Try our Online ASCII Converter for bidirectional conversion between text and ASCII codes, with support for decimal, binary, octal, and hexadecimal formats.