{
  "id": "ascii",
  "title": "ASCII",
  "lang": "en",
  "source_lang": "en",
  "summary": "ASCII is a seven-bit character-encoding standard whose assignments underpin modern text processing, programming languages, and Internet protocols.",
  "category": "computer-science",
  "subcategory": "software",
  "type": "concept",
  "aliases": [
    "American Standard Code for Information Interchange",
    "US-ASCII"
  ],
  "generated_at": "2026-11-02",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/ascii/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/ascii/",
      "json": "https://aiwiki.page/zh/ascii.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "ASCII, the American Standard Code for Information Interchange, is a character-encoding standard that assigns numerical values to letters, digits, punctuation marks, and control functions. It uses seven bits, providing \\(2^7 = 128\\) possible values, numbered from 0 to 127. Its printable repertoire principally serves the English language: it includes the 26 uppercase and 26 lowercase Latin letters, ten decimal digits, spaces, and punctuation used in writing and computing. The remaining assignments support functions such as line movement, device control, and communication.\n\nFirst published in 1963 and substantially revised in 1967, ASCII helped replace incompatible manufacturer-specific codes with a common representation for exchanging information among computers and communications equipment. Its influence extends far beyond the seven-bit systems for which it was designed. Programming syntax, file formats, and many Internet protocols depend on its character assignments. Unicode preserves all 128 ASCII values, and UTF-8 represents those values with exactly the same single-byte sequences as ASCII.\n\nASCII is a character code, not a typeface, keyboard layout, or complete description of a text document. It specifies which numerical values represent particular characters and controls; other standards and software determine how those values are transmitted, displayed, combined into lines, or interpreted as instructions."
    },
    {
      "heading": "Origins and standardization",
      "text": "ASCII emerged from the convergence of computing and telegraphy. Early computers commonly used character codes tailored to particular manufacturers, machines, or applications. Telegraph systems often used five-bit codes, including the International Telegraph Alphabet No. 2, which relied on shifts between letter and figure repertoires. Five bits provided only 32 combinations, so the same numerical value could represent different characters depending on the current shift state. Such arrangements economized on transmission and equipment but complicated the interchange of mixed text and computing data.\n\nThe American Standards Association established the X3 committee on computers and information processing in 1960. Work within its X3.2 subcommittee produced the first ASCII standard, designated ASA X3.4-1963. Robert W. Bemer was an influential participant in the development and promotion of standardized character coding, while Hugh McGregor Ross contributed to related international standardization. ASCII was a committee product shaped by the needs of equipment manufacturers, communications organizations, and users rather than the invention of a single individual.\n\nSeven bits represented a compromise between repertoire size and implementation cost. A six-bit code offered only 64 combinations, too few to accommodate uppercase and lowercase letters, digits, punctuation, and a substantial control repertoire simultaneously. Seven bits doubled that capacity without requiring an eight-bit character code. The structure also reflected the practical demands of paper tape, teleprinters, and serial communication, where every additional transmitted or stored bit carried a significant cost.\n\nThe 1963 edition differed from the familiar later code. The major 1967 revision established the lowercase alphabet and much of the arrangement recognized today. Further revisions clarified and maintained the standard. The designation ANSI X3.4-1986 became a widely cited reference for the mature ASCII repertoire. Changes in the name of the standards organization—from the American Standards Association through the United States of America Standards Institute to the American National Standards Institute—also explain the different institutional names found in historical references.\n\nInternational work developed alongside the American standard. ISO/IEC 646 standardized a closely related seven-bit coded character structure with provisions for national variants. ASCII became the United States version of that international family, but national versions were not necessarily identical to it. This distinction mattered when exchanging punctuation-heavy source code across countries.\n\nAdoption was gradual rather than universal. IBM introduced its System/360 family in 1964 using EBCDIC, an eight-bit encoding with different assignments. ASCII nevertheless spread through communications equipment, minicomputers, and later microcomputers. Its importance arose not from eliminating all competing encodings immediately, but from becoming a durable interchange convention across otherwise different systems."
    },
    {
      "heading": "The code space and printable repertoire",
      "text": "ASCII contains 128 positions. Of these, 33 are control characters: values 0 through 31 and value 127. The other 95 positions, from 32 through 126, are printable characters, counting the space as printable even though it normally produces no visible mark. The assignments are commonly written in decimal, hexadecimal, octal, or binary. For example, uppercase A is decimal 65, hexadecimal 0x41, octal 101, and binary 1000001. These are different notations for one assigned value, not different encodings.\n\nThe main divisions are:\n\nDecimal range | Hexadecimal range | Contents\n0–31 | 00–1F | Control characters\n32 | 20 | Space\n33–47 | 21–2F | Punctuation and symbols\n48–57 | 30–39 | Digits 0–9\n58–64 | 3A–40 | Punctuation and symbols\n65–90 | 41–5A | Uppercase letters A–Z\n91–96 | 5B–60 | Punctuation and symbols\n97–122 | 61–7A | Lowercase letters a–z\n123–126 | 7B–7E | Punctuation and symbols\n127 | 7F | Delete\n\nThe ordering has useful mathematical properties. Decimal digits occupy a contiguous interval, so the numerical value of an ASCII digit can be obtained by subtracting the code for 0:\n\n\\[\\operatorname{digit\\ value}(c)=\\operatorname{code}(c)-48, \\qquad 48\\leq \\operatorname{code}(c)\\leq 57.\\]\n\nThe two alphabets are also contiguous. Corresponding uppercase and lowercase letters differ by 32, or hexadecimal 0x20: A is 0x41, while a is 0x61. Within the alphabetic ranges, changing that bit changes case. Applying the same operation indiscriminately to arbitrary characters is not a general case-conversion method, because it also transforms some punctuation and does not implement the casing rules of other writing systems.\n\nASCII’s punctuation includes symbols especially important in computing: parentheses, square brackets, braces, angle brackets, quotation marks, the apostrophe, slash, backslash, underscore, vertical bar, and grave accent. Their later prominence in programming languages gave these assignments an importance disproportionate to their role in ordinary prose. Some names are easily confused: the ASCII apostrophe ' is not a typographic right quotation mark, and the grave accent ` is not a typographic left quotation mark.\n\nThe standard assigns abstract characters rather than particular drawings. A font may render the lowercase a with one storey or two, or distinguish zero from uppercase O with a slash or dot, without changing the character’s ASCII value. Conversely, visually similar marks need not be the same character. ASCII hyphen-minus, value 45, is distinct from Unicode’s en dash, em dash, and mathematical minus sign. These distinctions become important when text is copied between typography-oriented applications and syntax-sensitive software."
    },
    {
      "heading": "Control characters and terminal behavior",
      "text": "ASCII’s control repertoire reflects its origins in devices that printed, moved paper, punched tape, or exchanged messages over communications links. Control characters do not generally denote visible symbols. Their assigned meanings describe actions or structural functions, although a particular device or application may implement only a subset. The code alone does not guarantee that receiving a control character will produce any specific physical effect.\n\nSeveral controls concern page and line layout. Backspace, BS, is decimal 8; horizontal tabulation, HT, is 9; line feed, LF, is 10; vertical tabulation, VT, is 11; form feed, FF, is 12; and carriage return, CR, is 13. On a mechanical printer, carriage return moved the print position back toward the beginning of a line, while line feed advanced the paper. Because these were distinct operations, a new printed line could require both. This mechanical distinction survives in contemporary newline conventions.\n\nOther controls mark message boundaries or coordinate communication. SOH means start of heading, STX start of text, ETX end of text, and EOT end of transmission. ACK and NAK indicate positive and negative acknowledgment in protocols that assign them those roles. SYN supports synchronization in synchronous communication schemes. The four information separators, FS, GS, RS, and US, were intended to separate files, groups, records, and units. Their existence does not mean that ordinary modern text files use them as delimiters.\n\nNUL, value 0, and DEL, value 127, have especially distinctive histories and later uses. NUL supported uses such as filling time or space without supplying an ordinary printable character. DEL’s all-ones bit pattern was useful with punched tape: punching every position could obliterate a previously punched character. In contemporary software, NUL frequently terminates strings, while DEL may be generated or interpreted as a deletion-related terminal input. Neither contemporary convention exhausts the historical meaning of the code.\n\nThe four device-control characters, DC1 through DC4, occupy values 17 through 20. DC1 and DC3 are widely associated with software flow control as XON and XOFF: a receiver can request that a sender resume or suspend transmission. Their familiar keyboard forms are Control-Q and Control-S. These meanings belong to communication conventions layered on the character assignments, not to every possible occurrence of those byte values.\n\nESC, value 27, introduces escape sequences in many terminal systems. A sequence beginning with ESC can select colors, reposition the cursor, or erase part of a display under an applicable terminal-control standard. ASCII itself does not define that entire command language. Likewise, caret notation such as ^G for BEL or ^M for CR is a visible representation used by tools and documentation; it consists of two printable characters, not the control character it denotes."
    },
    {
      "heading": "Seven-bit data in storage and transmission",
      "text": "ASCII defines a seven-bit coded character set, but it does not prescribe a single physical transmission method or storage format. A code value can be carried through a serial line, stored in memory, written to a file, or embedded in a larger data structure. The distinction between a character’s assigned value and its physical representation is essential: seven-bit ASCII can be stored in eight-bit units without becoming a different character repertoire.\n\nOn contemporary computers, an ASCII character is usually stored in one byte, with the most significant bit set to zero. Thus A, whose seven-bit representation is 1000001, commonly occupies the byte 01000001. A sequence of \\(n\\) ASCII characters stored this way requires \\(n\\) bytes before accounting for file-system overhead or additional formatting. Because each character occupies a single byte, ASCII itself has no byte-order problem. Endianness becomes relevant to multi-byte numerical representations, not to the ordering of bits within an ASCII code assignment.\n\nSerial links historically used several combinations of data bits, parity, and stop bits. A link might carry seven data bits plus a parity bit, allowing the receiver to detect some transmission errors. The parity bit is not an eighth ASCII data bit: it is calculated from the transmitted data according to an even- or odd-parity convention. Parity detects every error affecting an odd number of protected bits, but it neither corrects errors nor detects every possible corruption.\n\nThe familiar notation “8-N-1” describes eight data bits, no parity, and one stop bit. It is a serial framing configuration, not a character encoding. A device operating with that configuration can carry ASCII or arbitrary eight-bit data. Conversely, a seven-data-bit configuration cannot transparently carry every possible byte value. A mismatch between framing settings can corrupt text even when both devices nominally use ASCII.\n\nOlder communication paths sometimes cleared, repurposed, or failed to preserve the high bit of each byte. Such paths could reliably transport ASCII while damaging encodings that required values above 127. This limitation encouraged transport encodings that express arbitrary binary data through a restricted printable repertoire. Base64, for example, represents groups of binary bits using ASCII letters, digits, and a small number of punctuation characters. Its principal alphabet encodes six bits per character, increasing the size of long data sequences by approximately one third before line wrapping or other overhead.\n\nASCII provides no inherent error detection, compression, encryption, or document structure. A byte sequence containing only values below 128 is compatible with the ASCII code space, but its meaning may still be binary data rather than text. Identifying an encoding therefore involves conventions and context as well as examining the numerical range of the bytes."
    },
    {
      "heading": "Programming languages and text processing",
      "text": "ASCII strongly influenced the surface syntax of programming languages. Its letters form identifiers and keywords, its digits form numerical literals, and its punctuation supplies operators and delimiters. Languages designed for ASCII-oriented environments made extensive use of brackets, braces, semicolons, backslashes, and other symbols that earlier character repertoires did not always provide together. The result was a feedback relationship: ASCII supported programming notation, and widely used programming notation made faithful ASCII interchange increasingly important.\n\nThe C programming language illustrates both the influence and the limits of this relationship. Its string literals use escape notation such as \\n for a newline, \\r for carriage return, and \\t for horizontal tabulation. These are source-code spellings interpreted by the language implementation; a backslash followed by n is not itself ASCII line feed. C implementations are not universally required to use ASCII as their execution character set. The language guarantees contiguous codes for decimal digits, but portable C cannot assume every ASCII-specific numerical relationship, such as a difference of 32 between corresponding letter cases.\n\nC also made NUL-terminated strings especially influential. A character array containing C, A, T, and a zero-valued character represents the string “CAT” under that convention. NUL is a terminator rather than a printable component of the string, so a zero byte embedded in incoming data can cause a string-processing function to observe less data than another component expects. A null character is distinct from a null pointer, even though programming terminology and some source-code spellings can make them appear related.\n\nASCII ordering affects sorting and comparison. In ascending code order, digits precede uppercase letters, and uppercase letters precede lowercase letters. A bytewise comparison therefore places Z before a, which does not match ordinary case-insensitive dictionary order. Punctuation also occupies several separate intervals. A database or programming library may instead apply a collation that handles case, accents, and language-specific ordering; such behavior is an additional text-processing rule rather than a property of ASCII.\n\nRegular expressions and validation routines frequently distinguish ASCII classes from broader character categories. The explicit range [0-9] identifies the ten ASCII digits in common regular-expression systems, whereas a shorthand such as \\d may include additional Unicode decimal digits, depending on the implementation and mode. Similarly, accepting only ASCII letters is different from accepting all letters. This distinction matters for file formats, identifiers, and protocols that deliberately define a narrow alphabet.\n\nASCII-only arithmetic shortcuts remain useful when their preconditions are explicit, but they do not generalize to multilingual text. Case conversion, character counting, and text boundaries can require more than inspecting individual bytes. Modern libraries therefore commonly separate byte operations, code-point operations, and language-sensitive text processing."
    },
    {
      "heading": "Internet protocols, files, and line endings",
      "text": "Many early Internet protocols adopted ASCII because it provided a widely shared repertoire that could be inspected with simple terminals and diagnostic tools. Commands and responses could be expressed as readable words and decimal numbers rather than as machine-specific binary structures. This did not make every protocol purely textual: textual headers and commands could coexist with encoded or binary content.\n\nSMTP, the mail-transfer protocol, historically operated within a seven-bit transport model. Its commands and replies use ASCII-based syntax, while later extensions and message-format conventions support richer content. Email consequently developed mechanisms that distinguish message character sets from transport encodings. MIME can identify a text part’s encoding, such as UTF-8, and use Base64 or quoted-printable when the transport representation requires it. Encoding a message for transport is a different operation from choosing the character encoding of the original text.\n\nHTTP likewise uses familiar ASCII characters in important parts of its syntax, including method names, field names, digits, and delimiters. The contents of an HTTP representation need not be ASCII. An HTTP exchange may carry a UTF-8 document, a compressed archive, or an image. Later HTTP versions also demonstrate that preserving protocol meaning does not require preserving a line-oriented textual wire format: HTTP/2 and HTTP/3 use binary framing.\n\nLine endings are a particularly durable interoperability issue. Unix-like systems, including Linux, conventionally use LF as the line separator in text files. Microsoft Windows commonly uses the two-character CRLF sequence. Classic Mac OS used CR. These conventions use ASCII control characters but are not all prescribed by ASCII itself. A file transferred without appropriate interpretation can display stray carriage-return markers or appear to have missing line breaks.\n\nNetwork specifications often choose one line-ending convention explicitly. SMTP command lines and HTTP/1.1 lines use CRLF. Software that treats CR, LF, and CRLF interchangeably may disagree with another component that follows stricter rules. Such disagreements can have consequences beyond untidy display, because different components may identify message boundaries differently.\n\nASCII also remains visible in structured data. JSON uses ASCII punctuation for its structural syntax, although strings can contain Unicode characters. HTML and XML similarly combine ASCII-based markup delimiters with support for a much broader text repertoire. The surrounding syntax and the document’s character encoding are related but distinct layers.\n\nThe phrase “plain text” therefore does not mean “ASCII.” A plain-text file may use UTF-8, another Unicode encoding, or a legacy encoding. It may also differ in newline conventions and contain control characters. Reliable interchange depends on specifying these details rather than assuming that an absence of rich formatting determines the byte representation."
    },
    {
      "heading": "National variants and eight-bit extensions",
      "text": "ASCII’s repertoire is insufficient for most of the world’s writing systems and even for much text written with Latin letters. It lacks accented letters such as é, German ß, and most currency and typographic symbols. Its original scope reflected a practical American interchange standard, not a comprehensive inventory of written language. Efforts to overcome these limitations followed two major paths: reassigning selected positions within seven bits and using the additional values available in eight-bit encodings.\n\nISO/IEC 646 allowed national variants in which some positions could represent locally important characters. The United Kingdom version, for example, used the position occupied by the ASCII number sign for the pound sign. Other national variants replaced punctuation positions with accented letters or other national characters. These substitutions preserved a seven-bit code but made certain byte values ambiguous without knowledge of the variant in use.\n\nThat ambiguity was especially troublesome for programming. A character used as a brace or bracket in one environment could appear as a national letter in another. Programming-language mechanisms such as C’s historical trigraph sequences were partly intended to allow source representation on character sets lacking particular punctuation. Such workarounds show that internationalization problems concerned executable syntax as well as prose.\n\nEight-bit encodings provided 256 possible values. Many retained ASCII assignments in the lower half and used values 128 through 255 for additional characters. Nevertheless, “extended ASCII” is not the name of one universal encoding. It is an informal label for multiple incompatible schemes. Identical upper-half bytes can denote different characters under different encodings, and some eight-bit encodings reserve additional positions for control functions rather than printable symbols.\n\nISO 8859-1, commonly called Latin-1, supports many Western European languages. Its printable supplementary characters occupy hexadecimal A0 through FF, while positions 80 through 9F belong to the C1 control area rather than to a further block of graphic characters. Windows-1252 preserves much of Latin-1 but assigns printable characters, including typographic quotation marks and the euro sign, to several positions in that intervening range. Treating the two encodings as interchangeable can therefore produce visible errors.\n\nIBM PC code pages followed another tradition. Code page 437 included accented letters, box-drawing characters, and mathematical and other symbols in its upper half. Its hardware and software environment could also display graphical symbols for some low-valued character positions. Those display conventions did not redefine ASCII’s control characters as universally printable images.\n\nBecause these encodings shared the basic ASCII range, simple English text often moved between them without alteration. Their incompatibilities appeared when text used additional characters. A file containing only ASCII bytes provides no evidence that distinguishes several ASCII-compatible encodings, whereas a file containing higher-valued bytes requires an encoding label or other contextual information for reliable interpretation."
    },
    {
      "heading": "Unicode compatibility, security, and continuing uses",
      "text": "Unicode incorporates ASCII as its first 128 code points, from U+0000 through U+007F. Uppercase A is therefore both ASCII value 65 and Unicode U+0041. This preservation concerns character identity and numerical assignment; it does not mean that every Unicode encoding stores those characters in the same bytes. UTF-16 and UTF-32 use wider code units, while UTF-8 preserves the original single-byte ASCII representation.\n\nUTF-8’s design makes this compatibility particularly useful. Every ASCII character is encoded as one byte in the range 0x00–0x7F. Bytes forming a multi-byte UTF-8 sequence all have their high bit set. Consequently, an ASCII byte cannot occur as a hidden part of a valid multi-byte encoding of another character. A program locating an ASCII slash or newline in valid UTF-8 will not accidentally match a continuation byte. This property simplifies many kinds of delimiter processing, although it does not by itself make an entire parser Unicode-aware.\n\nThe compatibility works in one direction: every valid ASCII byte sequence is valid UTF-8, but most Unicode text cannot be represented in ASCII. UTF-8 text containing Greek, Arabic, Chinese, or even many accented Latin letters includes bytes outside the ASCII range. Replacing unsupported characters with question marks loses information; transliteration produces an approximation rather than a reversible character encoding.\n\nEncoding disagreements also have implications for cybersecurity. If one component validates bytes under one interpretation and another interprets them differently, the two may disagree about delimiters, string endings, or message boundaries. Embedded NUL characters and inconsistent newline handling are recurring examples. Terminal escape sequences present a separate problem: untrusted text sent directly to an interpreting terminal can be treated as terminal instructions rather than merely displayed. These issues arise from interactions between encodings, protocols, and software behavior, not from a single defect intrinsic to ASCII.\n\nRestricting an identifier to ASCII can exclude many visually confusable Unicode characters, but it does not eliminate ambiguity or injection problems. ASCII itself contains easily confused shapes, such as lowercase l, uppercase I, and digit 1, and supplies the quotation marks and punctuation used by many command languages. Security depends on context-specific interpretation and validation rather than on the character repertoire alone.\n\nASCII also persists as a deliberately limited artistic medium. ASCII art uses letters, punctuation, and spacing to construct pictures, diagrams, and decorative lettering, usually relying on a monospaced display. Images made with box-drawing characters from a legacy PC code page or Unicode are often colloquially called ASCII art, although they are not strictly ASCII. In protocol grammars, source files, diagnostic output, and text-based interfaces, the original seven-bit repertoire continues to provide a small, stable set of characters whose assignments are shared across an exceptionally broad range of systems."
    }
  ],
  "links": [
    "character-encoding",
    "bit",
    "english-language",
    "computer",
    "internet",
    "unicode",
    "ibm",
    "byte",
    "programming-language",
    "c-programming-language",
    "database",
    "email",
    "hypertext-transfer-protocol",
    "linux",
    "microsoft-windows",
    "html",
    "cybersecurity"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}