# How can one byte hold 256 possibilities?

Forgive this seemingly "troll-ish" question, but I must lack the ability to understand how one byte (two nibbles, eight bits, however you wish to describe it) can hold 256 different states, possibilities, values or such.

First of all, one bit would look like this: Any way of being able to input two states (in the poor example above, two separate circuits at different voltages can be treated logically as "yes" or "no").

So if one bit is two possible states, multiplication factors yield that by two:

Bit = 2 values

Two bits = 4 values

Three bits = 6 values

Four bits = 8 values

Five bits = 10 values

Six bits = 12 values

Seven bits = 14 values

Eight bits = 16 values

In total, I get a sum of sixteen values multiplying the factors by two for every increasing bit. How would it make sense that one byte can hold 256 different values in a circuit?

In a four bit adder, we'd have something like this: This also yields 8 possible values. How would it get 128? Could anyone clarify this confusion??

NOTE: This doesn't have to just apply to adders circuits with transistors and logic gates, but to the pits and lands on an optic disc, the platter representation of data on a disk drive, flash drive binary storage, RAM, anything. I just want to know how increasing factors of two is multiplied by (seemingly) powers thereof.

• While one bit holds 2 possible values and two bits hold 4, it is not true that 3 bits hold 6; they hold 8. For that list, you've been adding 2 every time you add a bit, not multiplying by 2. – Dennis Meng Jan 8 '14 at 0:01
• "multiplication factors yield that by two" -- why do you add two, then, instead of multiplying? – Raphael Jan 8 '14 at 8:45
• I think what you are doing is multiplying by 2 the number of bits, when you should multiply by 2 the number of states with one fewer bits. If 2 bits offer 4 states, 2+1 bits offer 4*2 states. The reason is that n+1 bits can be in $2^n$ states with the extra bit on and another $2^n$ with it off; adding a number to itself doubles it; powers of 2 follow naturally. – PJTraill Sep 12 at 18:21

I just did a quick animation to convince you. Yellow is one, blue is zero. • Most original answer I've seen on CS:StackExchange. – Guy Coder Jan 10 '14 at 13:30
• Nice!!!! +1 :-D What software did you use? – Vor Jan 10 '14 at 14:37
• Done in Mathematica. Here is the code: gra[x_] := Graphics@{EdgeForm[Directive[Thick, Black]], Table[{If[BitGet[x, i] == 1, Yellow, Blue], Rectangle[{8 - i, 0}, {7 - i, 1}]}, {i, 0, 7}], Text[Style[x, Large], {10, 0.5}]};Export["counter.gif", Table[gra[i], {i, 0, 255}]] – A.Schulz Jan 10 '14 at 15:49
• Cute but how does something flashing ten times a second convince anybody of anything? – David Richerby Jan 11 '14 at 2:39
• @RichieThomas: In 8 bits, to be precise. – Dave Clarke Jul 14 '17 at 8:50

You said you were going to multiply by two each time but you added.

The simplest way to see it is just to count them.

One bit: 0 or 1 -- two values.
Two bits: 00, 01, 10 or 11 -- four values.
Three bits: 000, 001, 010, 011, 100, 101, 110, 111 -- eight values.
Four bits: 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111 -- sixteen values.

etc.

Forgive this seemingly "troll-ish" answer, but I think that perhaps you should learn how to count — in binary, that is, and using eight-bit strings to represent the numbers.

Zero:   00000000
One:    00000001
Two:    00000010
Three:  00000011
Four:   00000100
Five:   00000101
Six:    00000110
Seven:  00000111
Eight:  00001000
Nine:   00001001
Ten:    00001010
Eleven: 00001011


and so on. Take the time to actually carry on this process, at least to one hundred. It won't take long, and it will help to build into you the visceral understanding of exactly how it is that eight bits can represent two hundred and fifty six possibilities — you will not merely know it, you will grok it.

• I have deliberately rolled back an edit, in which "follow after me" was edited out, which was deemed patronising. I apologise if it seems offensive. But I say it in order to reinforce that I'm not simply demonstrating something --- I am explicitly telling the OP that they should actually carry out the exercise of counting up to one hundred in binary. It is analogous to the simple learning processes which one partakes of in childhood, and has the same irreplaceable learning value of such childhood exercises. There is sometimes no substitute for direct experience. – Niel de Beaudrap Jan 8 '14 at 10:30

Your misunderstanding and confusion comes from very basic point that you should not multiply 2 into the number of bits. Instead you should use power function.

So your calculations should become like these:

1 Bit = 2 values -> 1^2 =2, Your answer is correct

Two bits = 4 values - > 2^2=4. Your answer is correct

Three bits = 6 values -> 2^3=8*, Your answer is incorrect. You have multiplied 2*3 which is incorrect.

Four bits = 8 values - > 2^4 = 16 Your answer is incorrect. You have multiplied 2*4 which is incorrect.

Five bits = 10 values -> 2^5=32, Your answer is incorrect. You have multiplied 2*5 which is incorrect.

Six bits = 12 values -> 2^6=64, Your answer is incorrect. You have multiplied 2*6 which is incorrect.

Seven bits = 14 values -> 2^7=128, Your answer is incorrect. You have multiplied 2*7 which is incorrect.

Eight bits = 16 values -> 2^8=256, Your answer is incorrect. You have multiplied 2*8 which is incorrect.

• Let me explain why do you need to use power function (2^3) instead of multiply (2*3) to find the number of values to show using 3 bits. Using various combination of each bit you can show the following values

000 ----> 0

001 ----> 1

010 ----> 2

011 ----> 3

100 ----> 4

101 ----> 5

110 ----> 6

111 ----> 7

From 0 to 7, there are 8 numbers.

Similarly for 4 bits, you can replicate the same rule.

0000 ----> 0

0001 ----> 1

0010 ----> 2

0011 ----> 3

0100 ----> 4

0101 ----> 5

0110 ----> 6

0111 ----> 7

1000 ----> 8

1001 ----> 9

1010 ----> 10

1011 ----> 11

1100 ----> 12

1101 ----> 13

1110 ----> 14

1111 ----> 15

Which are 16 numbers. So we need to say 2^4 = 14. Using multiplication is incorrect. So, for 8 bits, you can repeat it from

00000000 --->0

.

.

.

11111111 ----> 255

One more point, I can guess you have one more confusion. Let me tell you that If you want to know the largest number you can store in a byte, it is good to know that it is 255! not 256 not even 512.

The calculation is not x*2. It is in fact, the number of states one bit can hold (2) to the power of however many bits there are. This means it is exponential. The formula would also work for tertiary systems. Going back to binary, 2^8 = 256. 2^1 = 2, and 2^4 = 8. These are just a few examples but this makes more sense if I explain it properly, so, to represent a number with binary didgits, the computer uses the first column for "1", The second for "2", the third for "4" and the fourth for "8". You may not have noticed the trend here, the number of states possible is going to be the highest number possible to present with the given bits, plus one for "000000"etc., therefore shifting the 111111111etc. To the next column, 10000000etc. Because 10000 is 1 more than 1111 in binary.

I thought a simpler way to understand this is to think of how we count numbers. If each unit of 10s were considered a bit with 10 possible states, then 2 bits would have 100 possible states, or 10*10. 3 bits would thus have 1000 states or 100*10, which is also expressed as 10*10*10 10^3. In the case of binary, each unit or bit has only 2 possible states, thus 1 bit = 2, 2 bits=2*2=4, 3 bits=4*2 or 2*2*2 or 2^3=8 and so on and so forth. So if 8 units (bits) of 10 yields a hundred million of states, it should be quite easy to fathom how 8 bits of binary could yield 256 (if you count the first 0 as a state).