# How to get from 1 byte to 2 bytes

We have `1 byte`, which is `8 bits`, which is `2^8`. Now `2 bytes` should be `2 * 1 byte`, which is `2 * 2^8 = 2^9`, but actually 2 bytes is `2^16`. What am I missing here? It seems like `2 bytes` isn't `2 * 1 byte`, it's more like `1 byte * 1 byte`, but this should give you `byte^2`, which doesn't make sense.

Can please someone explain to me what I am getting wrong here?

• "`8 bits`, which is `2^8`." Explain this? 8 is `2^3` – Gareth Jun 30 '13 at 18:35
• `8 bits` means you can have from 8 zeroes to 8 ones, so max value is `2^8 -1`. And because all values are different, you can have `2^8 - 1` values + zero, which gives `2^8`. – dhblah Jun 30 '13 at 18:40
• Your confusion stems from the fact that you're trying to count bits (8 bits in one byte) and then use what they represent (8 bits represents up to `(2^8)-1`) to measure increasing size. Ergo, twice 8 bits is 16 bits. Twice what 8 bits can represent is 9 bits. – Blrfl Jun 30 '13 at 22:34
• Where N is the number of bytes, it's not `N * (2^8)`. It's `2^(8*N)`. – AlbeyAmakiir Jun 30 '13 at 22:39

You have one byte, which is 8 bits

So far so good

which is 2^8

Your use of "which is" here seems to be the root of your confusion. A more precise statement is:

8 bits can represent 2^8 distinct values.

Or generally:

N bits can represent 2^N distinct values.

If this is unclear, it may help you to think about decimal digits (0-9). One decimal digit can represent 10 distinct values (0-9), two decimal digits can represent 10^2=100 distinct values (0-99), N decimal digits can represent 10^N distinct values.

A bit is literally a binary digit. One bit can represent two distinct values (0-1), two bits can represent four distinct values, and N bits can represent 2^N distinct values.

So eight bits can represent 2^8 distinct values, and sixteen bits can represent 2^16 distinct values.

There are two aspects: the size and the number of representable states. Increasing the size by one bit multiply the number of representable states by 2 (you get all the previous state with the additional bit set to 0, and again all the previous states with the additional bit set to 1). By consequence, doubling the size squares the number of representable states (you have N possible states for the first element which have to be combined with N states for the second, thus in total N²). If you think in decimal, adding one decimal digit multiply the number of values by 10 (and doubling the number of decimal digits still squares the number of values).

With 8 bits bytes:

• 1 byte is 8 bits and can represent values between 0 up to 2^8 (not included).

• 2 bytes is 16 bits and can represent values between 0 up to 2^16 (not included).

If you had a machine with 2 decimal digit bytes:

• 1 byte would be 2 decimal digits and you could represent values between 0 up to 100 (not included).

• 2 bytes would be 4 decimal digits and you could represent values between 0 up to 10000 (not included).

• So if I undestand you corectly, I can't make math operations directly on bytes, I need to convert bytes to bits at first, and then perform an operation, in that case `2 bytes = 2 * 1 byte = 2 * 8 bit = 16 bit = 2 ^ 16`. Althought this seems to be correct, I find it hard to comprehend, why is that? – dhblah Jun 30 '13 at 18:44
• What you are doing by multiplying by two is to keep one byte the same for all variations of the second byte. While in actual fact all possible bit variations for the first byte can be combined with all possible bit variations of the second byte, thus it is a matter of 2^8 * 2^8 variations instead of just 2 * 2^8 variations. – Marjan Venema Jun 30 '13 at 18:51
• then probably it's correct to name it double byte, not 2 bytes, as actually 2 bytes is just 1 byte multiplied by 2. I remember I encountered somewhere that notation, that it was called a double byte. – dhblah Jun 30 '13 at 18:55
• Thank you for your answer. So, I got it that there are two different things: size and number of states. Bytes is about size. And from size you got number of states. Ty for your answer. – dhblah Jun 30 '13 at 19:24
• 2 bytes is valid - you have to remember that you're talking about "width" here. 1 byte = 1 bank of 8 bits (2^8), 2 bytes = 2 banks (2^(8*2)), 3 bytes = 3 banks (2^(8*3)), etc. – HorusKol Jun 30 '13 at 22:06

If 1 byte were indeed `2^8`, then 2 bytes is not `2*(2^8)`, but `2^(2*8)`.

Where you went wrong is in assuming that the unit "byte" is exactly equivalent to the formula `2^8`. 2^8 is only the number of distinct states that you can represent with 8 bits.

In fact, "byte" as a unit is equivalent to `8 bit` (and not `2^8`). Therefore, 2 bytes is equivalent to `2*8 bit`, and you can represent `2^(2*8)` distinct states with these.

(Off-topic: To be somewhat more precise, a byte does not necessarily have to be 8 bits wide; that is only the most wide-spread size for bytes today. If you want a unit that always, unconditionally means exactly 8 bits, that would be the "octet".)

`Byte` is a term that refers to storage capacity. The contents of a byte-sized storage location is what you do math on. Doubling the value stored in a byte-sized bucket may or may not require two bytes of capacity to store the result. Doubling 2^8 results in 2^9 which requires the combined capacity of two bytes to store. Doubling 2^6 results in 2^7 which requires only one byte to store.