All guides

ASCII: How Computers Turn Letters Into Numbers

A number for every character

ASCII, agreed in the 1960s, assigns each character a code from 0 to 127. The printable characters start at 32, which is the space, and run through punctuation, digits, uppercase letters and lowercase letters to 126. Below 32 sit control codes from the teletype era: 9 is tab, 10 is newline, 13 is carriage return, 7 was the bell that physically rang. Only the newline family still matters daily, and the difference between systems that end lines with code 10 alone and those using 13 plus 10 still causes real bugs when files move between operating systems. Seven bits hold the whole table, which is why old systems spoke of seven bit characters.

The clever layout of the table

The table is designed, not random, and its patterns help programmers constantly. Digits 0 to 9 sit at codes 48 to 57, so a digit character becomes its value by subtracting 48. Uppercase A starts at 65 and lowercase a at 97, exactly 32 apart, so changing case is adding or subtracting 32, or flipping one bit. The letters are contiguous, so alphabetical sorting of plain ASCII text works by simple number comparison, which is also why capitalised words sort before lowercase ones in many tools, a quirk everyone meets eventually. Punctuation fills the gaps in tidy blocks. Once you see the table as a designed grid rather than a list, individual codes become easy to guess.

Why ASCII still matters in a Unicode world

Modern text uses Unicode, which covers every writing system, but its common encoding UTF-8 was designed so that the first 128 characters are stored as exactly their ASCII bytes. That means plain English text files from 1970 still open correctly today, and the foundations of the internet, from email headers to web addresses to file formats, remain ASCII at their core. When you convert text to codes with the tool here, you are looking at the same numbers a 1960s teletype would have punched into paper tape. Characters outside the table, accented letters, other alphabets and emoji, need the extra bytes UTF-8 adds, which is the subject of the companion guide on this site. One legacy of ASCII still bites weekly somewhere: the newline difference. Windows traditionally ends lines with codes 13 and 10 together, Unix systems with 10 alone. Most modern tools cope silently, but scripts, data files and version control systems still occasionally trip over the difference, producing files that look like one endless line or show stray symbols. Knowing that text is just numbers, and which numbers end a line, turns that mystery into a ten second diagnosis.

Try the calculator

The free tool that goes with this guide:

Convert text to ASCII codes