SUMMARY: This tip defines the computer memory term 'byte' and explains how 8 bits can hold one of 256 values.
In computer memory terms, the definition of a byte is a collection of eight bits. Unlike a bit that can hold the value of zero or one, a byte of memory can hold a value from 0-255.
Think of the below number as eight individual bits making up a byte, all turned off. The value is 0.
If we turn on the right-most bit in the byte, the 0th bit (computer scientists love to count starting from the number 0), the value is now one.
What if we want to add 1 to the value? Remember that a bit can only hold values of 0 or 1. So how is the number 2 represented? We turn on the bit to the left, the 1st bit, like so:
If the first bit is a 1 and the 0th bit is 0, the total value of all bits is 2. Now what if we want to add 1 to create a byte value of 3? Turn that 1st bit on again.
What happens if we want to create a value of 4? Remember how the 1st bit represented the number 2? The 2nd bit represents the number 4. Turn it on and turn the other two bits off.
And so forth. Here is a table:
Bit 7 - Value of 128
Bit 6 - Value of 64
Bit 5 - Value of 32
Bit 4 - Value of 16
Bit 3 - Value of 8
Bit 2 - Value of 4
Bit 1 - Value of 2
Bit 0 - Value of 1
An aside - If you know what exponentiation means, think of each bit taking on the value of two to the power of the bit number. 2 to the power of 0 is 1, 2 to the power of 1 is 2, etc.
So to get a byte value of 255, let's turn all of the bits on.
Several bytes can be strung together to form kilobytes, megabytes, gigabytes, and terabytes.
Return to the Computer Memory Definitions page.
The MalekTips website was created in 1998 by Andrew Malek of Envision Programming. The page's goal is to freely disperse computer-related tips, hints, and informative articles. Tips are organized to be easy to find, and are presented clearly, in easy-to-understand language.