Bits and meaning · Characters

Bytes can
be letters.

We have used bytes as numbers. With an agreed code, those same bits can stand for letters, digits, and punctuation. Nothing in the byte itself says which meaning to choose.

First time here? Explore bits and numbers

Read this byte using ASCII

A printed character

ASCII assigns decimal 65 to the character “A”. The bits have not changed; this is another way to interpret them.

Try a byte
One byte · eight bitsUnsigned · 0 to 255

Enable JavaScript to change this byte. This example shows 65.

Change the byte

Hex digit 4

Hex digit 1

Add the values of the bits that are on

64 + 1 = 65

Change a bit, edit a number, or select an example. The character readout interprets the same byte. This explorer labels non-printing codes without acting on them.

A letter needs an agreement.

The starting bits are 01000001: decimal 65, or hexadecimal 41. Read as an unsigned number, they mean sixty-five. Read using ASCII, they stand for the uppercase letter A.

A character encoding supplies the agreement between a stored value and a character. ASCII is one such agreement. Its name stands for American Standard Code for Information Interchange.

Select A, then a. They are different characters with different values. Notice that the rightmost bit is not the one that changes.

The character 0 is not a zero byte.

Select the example labelled 0. Its decimal value is 48, with bits 00110000. That is the code for the printed digit.

Now press Clear all bits. The byte becomes zero, and the character readout says NUL, meaning Null. It has no printed shape. The three letters NUL are our label for one code; they are not three letters stored in this byte.

The same distinction matters with more digits. The number 65 fits in one byte. The text “65” uses two ASCII characters: “6” followed by “5”.

Some codes leave no printed mark.

Select Space. Its value is 32. A gap between words still needs a code, so a space occupies a byte just as a letter does. This view uses the label SP to make it visible.

Select Line feed. Its value is 10, labelled LF. It is a control code: a receiver can use it to move to another line rather than draw a character. This explorer only identifies the code; it does not move a cursor.

Try decimal 7 (BEL, Bell), 13 (CR, Carriage return), or 127 (DEL, Delete). These labels let you inspect codes that otherwise would be hard to see. Selecting them here does not ring a bell or delete anything.

ASCII uses seven bits.

A byte has 256 possible patterns, but ASCII assigns only values 0 through 127. We hold those values in eight bits with the leftmost bit set to zero.

Other encodings provide more characters, sometimes using several bytes for one character. Sender and receiver need to agree on the encoding to read the same text.

A reference for the codes

The ASCII code table and names used here can be checked in RFC 20: ASCII format for Network Interchange. The letter shapes come from your browser’s font; the code specifies the character, not its exact drawing.

From a lamp pattern to a letter.

In Waiting for a byte, the 8080 received a byte and echoed it to the lamps. If that byte were 65, the lamps would show 01000001. A display using ASCII could show A for the very same output.

The CPU transfers the byte. The display gives it a visible form. The next lesson makes that connection with a simple text terminal.