I find several sources claiming that power-of-two bits in a binary word (such as 8-bits per byte) is a "good thing" or "convenient". I find no source pointing out why.

From What is the history of why bytes are eight bits? we read in the approved answer:

Binary computers motivate designers to making sizes powers of two.

Ok, but why? In the same question but in the comment field for the question I find:

Is the last sentence in jest? A 12-bit byte would be inconvenient because it's not a power of 2. - robjb

Again, void of rationale...

address calculations are a heck of a lot simpler with powers of 2, and that counts when you're making logic out of raw transistors in little cans - Mike

As bytes are the smallest addressable unit, this does not make much sense. Lots of upvotes on the comment though. Maybe I missed something.

From Wikipedia:

The de facto standard of eight bits is a convenient power of two permitting the values 0 through 255 for one byte

And this would be convenient because...?

For clarification, this is about the number of bits per byte (e.g. 8 or 6, etc), not the number of values per byte (e.g. 28 or 26, etc). Because of the confusion I also point out this is not about Word sizes.

I´m not overly interested in historical reasons. Those have been well explained elsewhere (see links).

Related question on SO: https://stackoverflow.com/questions/1606827/why-is-number-of-bits-always-a-power-of-two

  • 2
    @gnat I'm pretty sure we're talking about the number of bits per byte (i.e. 8 in an 8 bit byte) here, not the number of values a byte can represent (i.e. 2^8 in an 8 bit byte). So if you have, for example, a 6 bit byte, 6 is not a power of two, but yes, a 6 bit byte can represent a power of two number of values.
    – 8bittree
    Aug 11 '16 at 15:35
  • 2
    @8bittree I think I got it, thanks for explaining! (retracted duplicate vote - though I think it would be easier for readers if an explanation like in your last comment would be edited into the question, this thing seems rather subtle)
    – gnat
    Aug 11 '16 at 15:51
  • 2
    Similar question on SO: stackoverflow.com/q/1606827/3723423 - the answer brings some plausible arguments about convenience
    – Christophe
    Aug 11 '16 at 19:08
  • 2
    @Snowman: The OP's post contains a "begging the question" fallacy: "Why are powers of two considered convenient byte sizes?" They aren't. It has nothing to do with powers of two; he misread the sentence in the Wikipedia article. Aug 11 '16 at 21:32
  • 3
    @RobertHarvey In the answer to "What is the history of why bytes are eight bits?" (also linked in my question) there is the following sentence: "Binary computers motivate designers to making sizes powers of two." Did I misread this too? What do both sources mean in your opinion? Just saying "you got it wrong" is not really doing it for me.
    – Andreas
    Aug 12 '16 at 22:47

I don't think 8-bit bytes have been successful because they have a width which is a power of two. If you don't want to address bits individually -- and that's a common feature neither now nor in the past -- having a power of two is of no real practical importance (it's just -- now far more than in the past when sparing some discrete components was important -- a reflex for hardware and software engineers and staying in familiar ground is important for other purposes), and I don't remember having seen mentioned in my history of computing readings(1). One needed lower cases, that meant something more than the then dominant 6-bit character sets. ASCII was 7-bit, but ASCII was then though of purely as for inter-exchange (and thus to be translated to internal code for handling), and thus

The Subcommmitee recognizes that computer manufacturer are unlikely to design computers that use 7-bit codes internally. They are more likely to use 4-bit, 6-bit, and 8-bit codes. There is no widespread need at the present for interchange of more than 128 separate and distinct characters between computers, and between computers and associated input/output equipment. [paper tape, which had a natural frame size of 8 bits but needed parity so the payload of a frame was 7 bits is also cited in favor of 7-bit char for ASCII, power of two is not cited among the advantages of 8 bits] (2)

and for the hardware 8-bit byte won because it allowed to pack 2 decimal digits in one byte at a time when 75% of the data was numerical and represented in BCD(3).

(1) for instance Blaauw and Brooks, Computer Architecture; MacKenzie, Coded Character Sets, History and Development have both a discussion on that subject.

(3) Document of X3.2 -- the Subcommitee responsible of ASCII -- cited by MacKenzie.

(3) MacKenzie, again.

  • 1
    Thank you. Your answer is spot on and you brought references. You have my vote. I realize though if what you say is true it is also impossible to prove. Can´t prove the non-existance of something. I guess I should really interogate the ones claiming "convenience" and check their sources. Maybe it is just a wide spread rumor.
    – Andreas
    Aug 11 '16 at 20:04
  • The other convienience factor is that a byte can be represented easly as two hexidecimal values. Putting two binary coded decimals (BCD) in one byte is more commonly referred to as packed decimal. This was indeed considered convenient because the decimals can be read as decimal when data is displayed in hex.
    – JimmyJames
    Aug 12 '16 at 18:03
  • 12 bit bytes can be represented easily as three hexadecimal values. And you can store three BCD numbers in a 12 bit byte. Surely that's a lot better than two hexadecimal values and two BCD numbers. Actually, a 10 bit byte can contain three decimal digits. And I think that's how the IEEE decimal floating point standard works.
    – gnasher729
    Aug 12 '16 at 23:18
  • 1
    @JimmyJames, I think you get the causality reversed with hexadecimal. Hexadecimal became popular because it was a compact way to represent 8-bit byte, previously octal was far more popular (and it was more popular on a machine like the PDP-11 which had 8-bit bytes but where 3-bit fields was significant in the instruction set encoding). Aug 13 '16 at 5:25
  • @gnasher729, the 8-bit byte is a child of the 60's. Going from 6-bit char to 12-bit char was unthinkable in the 60's. Even today when we are far less constrained UTF-8 is popular because UTF-16 is deemed too wasteful. A 10-bit byte was about as unthinkable and the 10 bit per 3 decimal digits encoding is also totally unpractical when you are examining values in registers and in memory with a front panel without speaking about the impact on implementation with the technology of the time. Aug 13 '16 at 5:34

Other than historical accident, there is no particular reason why we should use 8 / 16 / 32 / 64 bit. I suppose that 12 / 24 / 48 / 96 bit would really be more useful.

For handling text, Unicode using a hypothetical UTF-24 would be cheaper than UTF32; hypothetical UTF-12 would store all single and double byte UTF-8 characters in 12 bits, and all triple and quad byte UTF-8 characters in 24 bits (the range would be slightly reduced to 2^20 characters, but that's still four times more than is generously used); code would be simpler because there are only two variants.

For floating point, 48 bit is usually enough. 96 bit is substantially better than 80 bit extended. 24 bit is useful for graphics; much more useful than the 16 bit supported by some graphics cards. 48 bit pointers can handle 256 terabyte.

About the only disadvantage is bit arrays, where a division by 12 is need to calculate byte positions. If that is felt to be important, I'm sure division by 12 can be implemented quite efficiently in hardware.

  • Interesting point about UTF, although being slightly off-topic. Floating point byte (or bit) size is an endless battle between memory and precision where you just have to live with one or the other. Good point about bit arrays too.
    – Andreas
    Aug 11 '16 at 20:22
  • 1
    Interesting thoughts, but I am not sure this answers the question.
    – user22815
    Aug 11 '16 at 21:01
  • 1
    The question was: "Why is eight bit considered convenient". Surely saying "it's not" answers the question.
    – gnasher729
    Aug 11 '16 at 21:23
  • 1
    @gnasher729 The question was: "Why is power of two bits per byte considered convenient", although your answer seems to apply just as well.
    – 8bittree
    Aug 11 '16 at 21:26
  • 2
    Comments are not for extended discussion; this conversation has been moved to chat.
    – yannis
    Aug 14 '16 at 11:24

This is convenient due to common hardware architectures using multiples of 8, e.g. 32-bit and 64-bit architectures. This means greater efficiency when using 8-bit data storage and transmission.

"However, considerations of economy in design strongly push for one size, or a very few sizes related by multiples or fractions (submultiples) to a primary size. That preferred size becomes the word size of the architecture."

Word (computer architecture)

See also: What is the history of why bytes are eight bits?

  • 5
    I will not accept this as an answer. My question is why power-of-two is convenient, not why defacto standard is 8-bit. And the history behind 8-bit mentions 5, 6 and 7 bits being used for real reasons, while going from 7 to 8 is motivated with a "meh, why not". I got the feeling reading different sources power-of-two had more to it than compatibility to current systems. (In reality the 8-bit gave 7-bit character sets parity.) Word is a different thing where I do get the benefit of power-of-two sizes, i.e. shift can be used instead of mult in calculations.
    – Andreas
    Aug 10 '16 at 19:51
  • 3
    @RobertHarvey This question isn't about the number of states per switch (i.e. binary vs trinary or more), it's about how many switches to group together. See my edit to the question.
    – 8bittree
    Aug 11 '16 at 17:24
  • 2
    As to your edit, there's no meaningful distinction between number of bits per byte and number of values per byte. It's two ways of expressing the same thing. The number of values that a byte can hold follows directly from the number of bits it contains: a byte has 8 bits, and so it can hold values up to 2⁸-1. Aug 11 '16 at 17:34
  • 2
    Logically, it follows that you pick a size for byte that can hold a numerical range that is convenient. ASCII is 7 bits because that provides for 128 different values, enough to encode both cases of the Roman alphabet, numeric characters, punctuation, control characters and several special characters. A byte can hold 7 ASCII bits and one parity bit for error checking, for a total of 8 bits, suitable for a teletype. We've been using that size for a byte ever since. Aug 11 '16 at 17:42
  • 2
    @JeremyKato The devices I mentioned are older (60s-80s era, for the most part), which is probably why you aren't familiar with them. ASCII, is actually a 7 bit encoding (parity is not part of the standard). But for the main part of your comment, no, I'm not missing anything. I understand there are reasons why 8 bits specifically is convenient, what you and Robert Harvey are missing is that the question is asking about powers of 2 bits in general, not specifically 8 bits.
    – 8bittree
    Aug 11 '16 at 20:21

According to Wikipedia article for word, this makes calculations related to addressing memory significantly easier:

Different amounts of memory are used to store data values with different degrees of precision. The commonly used sizes are usually a power of two multiple of the unit of address resolution (byte or word). Converting the index of an item in an array into the address of the item then requires only a shift operation rather than a multiplication. In some cases this relationship can also avoid the use of division operations. As a result, most modern computer designs have word sizes (and other operand sizes) that are a power of two times the size of a byte.

  • 2
    Yes, power of two times the size of a byte. There's no inherent reason why a byte should be eight bits and not nine, twelve or fifteen.
    – gnasher729
    Aug 12 '16 at 8:34
  • @gnasher729, much easier to divide by 8 (or 16 or 32 or 64) than it is to divide by 9 or 12 or 15. Aug 13 '16 at 1:50
  • @gnasher729 if word is power-of-2 bits, and power-of-2 bytes, this implies that byte has to be power-of-2 bits
    – vartec
    Aug 13 '16 at 2:17
  • @vartec The article and quote says "The commonly used sizes are usually a power of two multiple of the unit of address resolution (byte or word)" and "most modern computer designs have word sizes (and other operand sizes) that are a power of two times the size of a byte." I read "word size" is measured in bytes, not bits. There is no rule about word size in bits is or should be powers-of-2 in the article.
    – Andreas
    Aug 13 '16 at 8:38
  • @vartec: IF. Obviously nobody would build a machine with 32 bit words and 12 bit bytes. But nothing speaks against a machine with 48 or 96 bit words and 12 bit bytes. And there have been machines where a word was ten bytes.
    – gnasher729
    Aug 13 '16 at 14:30

It is tightly related to address space. By adding one bit more to your address bus, you can address twice as many memory locations. So when you add that extra line, you might as well use it to its full extend.

This leads to a natural progression of 1, 2, 4, 8, 16, 32 et cetera.

On a production technical level it is also easy to repeat the same lithographical pattern. That is, to double it. If you start out with one latch and then double the pattern, you will pass 8, not 6, 10 or 12.

  • 1
    How is that related to the number of bits in a byte? Are you seriously claiming that a 32 bit logical AND is easier to implement than 36 or 28 bits?
    – gnasher729
    Aug 12 '16 at 8:32
  • 1
    I did not make any such claim. My suggestion is it stems from earlier designs that were progressively extended in widrh as transistors got cheaper and ICs allowed for smaller circuits. Aug 12 '16 at 9:46
  • 1
    Interesting theory about production technical level. You might be on to something. Could you extend the paragraph or maybe provide a link explaining the basics?
    – Andreas
    Aug 12 '16 at 23:56
  • 1
    It's nonsense. For example, in a graphics card where all kinds of odd bit sizes are needed in various places, everything is done exactly with the required size, and not one bit more. If an h.264 decoder needs 19 bits precision for some operation, then the hardware implements 19 bits and not 20 or 24 or 32. And excuse me, you don't manipulate lithographical patterns. You define the hardware and then run it through some software that creates the layout.
    – gnasher729
    Aug 13 '16 at 7:12
  • 1
    @MartinMaat: You are confusing marketing + standardisation with technological reasons. And technology is what we are discussing.
    – gnasher729
    Aug 13 '16 at 14:37

Not always are word widths a power of two. I have recently been doing some coding in a SHArC DSP that has a 32-bit word width for numbers but not for the opcodes (which are 48-bits wide).

Probably the reason why word widths are a power of two is because of some instructions that test (or set or clear or toggle) a single bit or shift (or rotate) left or right by a specified number of bits. There is a bit field in the opcode to specify the location of the single bit or the number of bits to shift. If the word width is a power of two, this bit field requires log2(word_width) bits to cover the whole word. That is, a word that is 32 bits wide needs a 5-bit field in the opcode for these operations. If the word was 33 bits wide, it would need 6 otherwise it could not cover the whole word, but that would also be the case if the word was 64 bits wide.

Bits in an opcode are extremely valuable, so they don't usually wanna waste them. Then it makes sense to make the word a power of 2 wide.

The reason bytes are 8 bits wide is that it's the smallest power of two that can hold an ASCII character (which is 7 bits).

  • This is not my area of expertise but it sounds like a valid reason for power of two byte AND word sizes. I imagine you have to worry less about UB too. For a shift 33-bits would require 6-bit opcode, but only about half of the possible values (0-32) have useful meaning. Would you agree?
    – Andreas
    Aug 13 '16 at 7:35
  • the opcode needs to be wider than the bit field needed for the shift count. a byte is nothing other than a word that is 8 bits. the reason why computer hardware tends to use word sizes that are 8 or 16 or 32 or 64 bits (it's not always the case, the old DSP56000 had 24-bit words) is because of the reasons i gave above and the reason given by vartec: given a bitmap of packed words and you are given a row and column number of a particular pixel, one has to divide the column number by the word width to know which word to access to test or change the pixel. dividing by a power of 2 is easy. Aug 13 '16 at 7:44
  • What is a "bitmap of packed words"? Does HighColor suit that description?
    – Andreas
    Aug 13 '16 at 8:31
  • @robertbristow-johnson: Total lack of imagination. With 9 bit bytes, we would use 36 bit words, 130 million colors instead of 16 million colours in RGBA, RGB666 instead of RGB555 or the monstrosity RGB565 for low-quality color, and everything would be just fine. And ASCII would include 512 characters up to Latin Extended.
    – gnasher729
    Aug 13 '16 at 14:44
  • @Andreas, no, i meant two "colors". totally white or totally black. Aug 13 '16 at 16:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.