# 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. Commented Jan 8, 2014 at 0:01
• "multiplication factors yield that by two" -- why do you add two, then, instead of multiplying? Commented Jan 8, 2014 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. Commented Sep 12, 2020 at 18:21
• What are the four states with two bits ? And the six states with three ?
– user16034
Commented Apr 1, 2023 at 8:07

I just did a quick animation to convince you. Yellow is one, blue is zero.

• Most original answer I've seen on CS:StackExchange. Commented Jan 10, 2014 at 13:30
• Nice!!!! +1 :-D What software did you use?
– Vor
Commented Jan 10, 2014 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}]] Commented Jan 10, 2014 at 15:49
• Cute but how does something flashing ten times a second convince anybody of anything? Commented Jan 11, 2014 at 2:39
• @RichieThomas: In 8 bits, to be precise. Commented Jul 14, 2017 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. Commented Jan 8, 2014 at 10:30

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).

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.

• To be more precise, 255 is the largest number you can store in binary in a byte. Otherwise you can choose any 256 numbers to be represented by the 256 bit patterns. In particular, we often choose the range [-128,127]. Commented Apr 30, 2022 at 17:34

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.

Clearly, a single bit encodes two states, $$0$$ and $$1$$.

Then for two bits, if you claim that the number of states is four, then they must be $$00, 01, 10, 11$$ (another option would be just two states, $$00$$ and $$11$$, or - why not - setting the bits from left to right, $$00,10,11$$, for three states.)

Now for three bits: the trivial option is $$000, 111$$ (two states), the "setting" option is $$000,100,110,111$$ (four states) and the fully symmetric option can only be $$000,001,010,011,100,101,110,111$$ (eight states). I can't think of another enumeration that makes sense.

It is up to you, as an exercise, to generalize to eight bits.

There are at least two ways to count the number of states:

• all $$b$$ bits states can be obtained by concatenating either a $$0$$ or a $$1$$ to all $$b-1$$ bits states; this way all states are different, and no possibility is missed. E.g., there are four two-bits states, hence twice as many three-bits states, which is eight.

• you can write separately all states with no one, with a single one, with two ones, and so on, and all these can be permuted a certain number of times. E.g.

• $$000$$, a single permutation.
• $$001$$, three permutations (move the $$1$$ to any place).
• $$011$$, three permutations (move the $$0$$ to any place).
• $$111$$, a single permutation.

Again, the total is eight. Note that the numbers of permutations are known from combinatorial analysis as the Binomial numbers.

Finally, ponder the identities

$$2^b=2^{b-1}\cdot2,\\\sum_{k=0}^b\binom bk=2^b.$$

Visualizing the possibilities of a coin toss (instead of bits) helped me wrap my head around this issue, perhaps it might help you as well: (A = heads, B = tails)

One coin (2 possibilities = 2 x 1; head or tail shown as A B):

A   B


Two coins (4 possibilities = 2 x 2; AA = head & head, AB = head & tail, etc.):

AA   BB
_
AB   BA


Three coins: (8 possibilities = 2 x 2 x 2)

AAA   BBB
ABA   BAB
_
AAB   BBA
ABB   BAA


Four coins: (16 possibilities = 2 x 2 x 2 x 2)

AAAA   BBBB
ABAA   BABB
AABA   BBAB
AAAB   BBBA
_
ABBA   BAAB
ABAB   BABA
AABB   BBAA
ABBB   BAAA


Each new coin added, the possibilities get larger exponentially.

Let’s say with k bits we have n values.

If we add a bit, then we have n values where the added bit is set, and n values where the added bit is not set. Total 2n values. Every bit doubles the number of possible values.

0 bits: one possible value of nothing.
1 bit: twice as many values, that is two.
2 bits: twice as many values, that is four.
3 bits: twice as many values, that is eight (not six).

Since we know decimal better: One digit = ten possible values 0 to 9. Two of three digits don’t give 20 or 30 possible values, but 100 two digit values from 0 to 99 and thousand three digit values from 0 to 999.