How Computers Work

How Computers Store Text: From Telegraph Codes to Unicode

See how letters became numbers, from Morse and Baudot telegraph codes through ASCII and EBCDIC to Unicode, and why so many standards competed along the way.

On this page
  1. Letters Are Just Numbers by Agreement
  2. Telegraph Codes
  3. Punched Cards and Early Computers
  4. ASCII
  5. EBCDIC and Other Rivals
  6. The Era of Code Pages
  7. Unicode
  8. What Remains Unsolved

Letters Are Just Numbers by Agreement

A computer holds nothing but patterns of bits. To store a letter, people must agree on which pattern stands for which character. That agreement is a character encoding: a table that pairs each character with a number. When you type the letter A, the machine stores its code number, and when it later displays the text, it looks up the number and draws the matching shape.

The idea is older than computers, because the telegraph needed the same thing. Sending words over a wire meant turning them into a signal that could be sent and turned back.

Telegraph Codes

Morse code, developed in the 19th century, represented letters as short and long signals. It is not a fixed-length code. Common letters got shorter patterns, which made sending faster for people. That is sensible for a human operator, but awkward for a machine that expects regular groups.

Machines did better with fixed-length codes. In the 1870s, Émile Baudot devised a five-unit code for printing telegraph systems, and later variants of it were widely used in teleprinters. With five on-off positions there are 32 combinations (2 multiplied by itself five times), which is not enough for all the letters, digits and punctuation. The code solved this partly by using special “shift” characters that switched between a set of letters and a set of figures, so the same pattern could mean different things depending on the last shift.

Punched Cards and Early Computers

Punched cards had their own ways of representing letters and digits, using patterns of holes in columns. Business machines of the early 20th century established conventions that carried into computing. Many early computers handled numbers well and gave less attention to text, and different manufacturers often used their own internal character sets. Typing on computer keyboards produced whatever codes the maker chose, and moving text from one maker’s machine to another’s could therefore be difficult.

ASCII

In the early 1960s, American standards groups worked toward a common code, and the result was the American Standard Code for Information Interchange, known as ASCII. It used seven bits, giving 128 possible values. These covered uppercase and lowercase English letters, the digits, punctuation, and a set of control codes. Control codes did not print anything; they handled actions like starting a new line, ringing a bell or marking the end of a transmission, reflecting the code’s roots in teleprinter communication.

ASCII had a tidy design, with letters in alphabetical order so that sorting by code number roughly sorted words. It spread widely, particularly as personal computers and networks grew. Still, it was designed around English, and it had no room for accented letters or non-Latin scripts.

EBCDIC and Other Rivals

At around the same time, IBM used a different eight-bit code called EBCDIC (Extended Binary Coded Decimal Interchange Code) on its large systems. Its arrangement followed from the punched-card codes that came before it, which is partly why its letters do not sit in one unbroken run the way ASCII letters do. Both codes were in heavy use for many years, so text moving between systems often needed conversion.

This is one reason so many standards competed. Companies had large investments in existing equipment and data. A new code was welcome only if it did not break what already worked, and each maker’s customers had their own habits.

The Era of Code Pages

As computers spread beyond English-speaking countries, eight-bit bytes offered 256 values, so the extra 128 values beyond ASCII could be used for other characters. Different groups filled those slots differently. One arrangement suited Western European languages, another Greek, another Cyrillic, and manufacturers produced their own variants known as code pages. A document written under one table could look like nonsense when opened under another, since the same number meant a different character. This kind of garbled display is still sometimes seen.

Languages with thousands of characters, such as Chinese, Japanese and Korean, could not fit into 256 slots at all. They required systems using two or more bytes per character, and these varied by country and vendor.

Unicode

By the late 1980s, people from several organizations were working on a single character set intended to cover all of the world’s writing systems. The result was Unicode, whose first version appeared in the early 1990s. Unicode gives each character a unique number, called a code point, regardless of platform, program or language. It has since grown to cover many scripts, historical writing systems, symbols and emoji.

Unicode is a numbering of characters, not by itself a way to store them. Several encoding forms turn code points into bytes. The most widespread on the web is UTF-8, which uses one byte for the original ASCII characters and more bytes for others. Because it keeps ASCII text unchanged, it allowed older material to remain valid, which helped adoption.

What Remains Unsolved

A single standard does not resolve every difficulty. Deciding what counts as a distinct character can involve cultural and linguistic judgment. Sorting, case rules and text direction vary among languages. Legacy files in older encodings still exist, and software may guess the encoding wrongly.

The history here is less a straight line of improvement than a series of compromises between compatibility, cost and the needs of more languages. With bits and bytes in groups of eight, a byte could hold one ASCII-style character, which is why the two ideas became tied together. The practical lesson is that text, like any stored data, only makes sense when the reader knows which table was used to write it.

The complete guide to how computers work

How Computers Work: A Plain-Language Guide Through History
Read the guide

Keep exploring

Guides from other topics

All topics →