Why are there 8 bits in a byte? In some ways that is a
little like asking why there are 12 inches in a foot. That's
just the way it is. At some point in time, the folks building
computers decided this and it continues today.
But there is logic to it.
Remember that an 8-bit color depth has 28 or 256
colors, and that each of the RGB primary colors ranges from 0 to
255. With 8 bits in a byte, you can represent 256 values
ranging from 0 to 255, as shown here:
0 = 00000000
1 = 00000001
2 = 00000010
.....
254 = 11111110
255 = 11111111