Why do we use other bases which are neither binary (for computers) nor decimals (for humans)?

Computers end up representing them in binary, and humans strongly prefer getting their decimal representation. Why not stick to these two bases?

  • $\begingroup$ I tend to think there is no solid reason to use hex or anything with high amount of glyphs for numbers. Even more, I tend to think that binary rep can supersede other notations for general case in the future. $\endgroup$
    – Mikhail V
    Oct 24 '16 at 0:25
  • $\begingroup$ @MikhailV A hex representation is a LOT more concise than a binary representation. I'd say that's a pretty solid reason to use a larger number of glyphs than, say, 2. $\endgroup$
    – Ben Jones
    Jul 31 '18 at 17:52

Octal (base-8) and hexadecimal (base-16) numbers are a reasonable compromise between the binary (base-2) system computers use and decimal (base-10) system most humans use.

Computers aren't good at multiple symbols, thus base 2 (where you only have 2 symbols) is suitable for them while longer strings ,numbers with more digits, are less of a problem. Humans are very good with multiple symbols, but aren't that good in remembering longer strings.

Octal and hex use the human advantage that they can work with lots of symbols while it is still easily convertible back and forth between binary, because every hex digit represents 4 binary digits ($16=2^4$) and every octal digit represents 3 ($8=2^3$). I think hex wins over octal because it can easily be used to represent bytes and 16/32/64-bit numbers.

  • 8
    $\begingroup$ As an example, consider Hex values of RGB. It's easy to remember that white is #FFFFFF. It's harder to remember that white is 16777215 in decimal. You want to remove the red component of #EF439A? You get #00439A i.e. you just change the first two digits to 0. In decimal, you'd have to subtract 15663104. Good luck remembering that. $\endgroup$
    – jmite
    Jan 25 '14 at 23:14
  • 4
    $\begingroup$ To be accurate, colors in decimal notation would use triples, and white would be (255, 255, 255). We concatenate the hexadecimal values just because they are always 2 digits. We could do the same with decimals using 0's, then white would be 255255255 instead of 16777215. $\endgroup$
    – Spidey
    Jul 20 '16 at 18:55
  • $\begingroup$ @Spidey Exactly. Moreover my brain can parse something like (127,255,255) much easier and I can even guess how the color will look, since I can see proportion of ink amount and don't have to calculate it in hex in my head. $\endgroup$
    – Mikhail V
    Oct 24 '16 at 1:02

We use them for convenience and brevity.

Hex and Oct are really outstanding compressed representations of binary. Hex in particular is well suited to condensed forms of memory addresses. Every oct digit directly maps to 3 binary bits and every hex digit to 4 binary bits. This is a result of the bases (8 and 16) being powers of 2 ($2^3$ and $2^4$). For example, I can write binary $01101001$ as hex $69$ or if I extend it with a leading zero as oct $151$.

So, say you need a 64 bit memory addresses. You can either look at all 64 binary bits, or get it condensed to 16 hex digits. Often you don't need to compare a few addresses to see if their the same or contiguous. Would you rather look at 64 bits or 16 digits?

  • 5
    $\begingroup$ Octal has the benefit of not adding any digit symbols and may have been more practical in the days of 6-bit characters (and common non-power-of-two words, e.g., 12-bit PDP-8, 18-bit PDP-1 [address registers for CDC 6x00], 36-bit PDP-6, 60-bit operand registers for CDC 6x00). The move to octet characters/bytes and power-of-two words makes hexadecimal more attractive. $\endgroup$ Jan 25 '14 at 19:41
  • $\begingroup$ "Would you rather look at 64 bits or 16 digits?" Certainly I would look at grouped bits. But of couse not in "01" notation, which is ugly and hurts my eyes. And I don't even tell how much hex hurts my eyes. $\endgroup$
    – Mikhail V
    Oct 24 '16 at 0:50
  • $\begingroup$ @MikhailV: What do you mean by “"01" notation”? You say you would rather look at bits but not in “"01" notation” – what notation would you then use. If you say hex hurts your eyes I cannot help thinking you might have practised a little more on decimal than on hex. (Actually I thought it was (solo) sex that was said to be bad for your eyes, but that is another story.) $\endgroup$
    – PJTraill
    Nov 17 '17 at 18:06
  • $\begingroup$ I prefer this to dtech’s currently more popular answer because it emphasises ease of use, but you might have pointed out that not only the shorter representations but also the greater variety of digits make it easier to know where you are when reading a number in hex or octal. $\endgroup$
    – PJTraill
    Nov 17 '17 at 18:09
  • $\begingroup$ @PaulA.Clayton: good points; another advantage on the PDP-11 was that even though words (natural unit of operations) were 16 bits, most instruction codes fell naturally into a 2-bit operation and four 3-bit groups representing register number and address mode, both of which had 8 possibilities, of two arguments. My favourite: 014747 = MOV -(PC), -(PC), which fills memory with itself (if allowed). $\endgroup$
    – PJTraill
    Nov 17 '17 at 18:25

Binary numbers in text are a waste of space.

Decimal shows no relation to powers of $2$. Often the fact that a number is, say $5\cdot 2^n-1$, is more important than how much that is.



As already mentioned by other answers, there can be different notations for different purposes and constraints. Notations is actually an encoding as a sequence of characters, and we know from the study of algorithms and data structure that there are many ways we can encode abstract concepts, a list or a set for example, depending on what we want to do with it. In this case it is mostly algorithmic convenience.

When considering representation of numbers, the same applies. Inside the computer, everything is binary at the lowest level, though stranger representations can be used for some applications.

Outside the computer, we use any kind of human understandable representation, depending on human convenience regarding the kind of value represented. Binary representation is often too long and unstructured to be read and written easily, thus making place to hexadecimal or octal. The choice may often have to do with the way information is structured in a binary word, which is not necessarily intended to represent a number.

But, when considering only numerals, i.e. representation of numbers, it is worth looking at other number representation systems to understand that major factors are: physiology, habit, and convenience. Convenience is of course the leading factor creating diversity, as it depends on context of use.

A wider look

It is surprising that all answers so far consider only decimal and base $2^n$ systems, mostly binary, octal and heaxdecimal.

The body of the question seem in no way restricted to computers, and humans have been and are still using several other numeration systems. Some of them are even used within computers, for example when dealing with long integers (not to mention non integer numerals).

A first remark is that when people count in thousands, or millions as a unit, this is still considered decimal, because these are powers of 10. So one might wonder why octal or hexadecimal should not be considered just a variation on binary. One possible reason may be the number of symbols used to represent numbers (though that is disputable issue, as we shall see with other systems).

Then, regarding humans, they using several system in base 5, called quinary systems. Actually, most of these system are with two bases, the second one being 2 or 4, alternating with the base five, which makes them equivalent to base 10 (decimal) or base 20 (vigesimal). Guess where that comes from :)

These double-base systems are called bi-quinary or quadri-quinary systems. Pure quinary is rarely used.

Roman numeral may be seen as bi-quinary system (which is an indication on how to do arithmetics with them). Chinese and Japanese abacus use bi-quinary. Quadri-quinary was used by the Mayas.

The reason for using a system are probably many. One good reason is that it was the first local design, and people are now used to it. For example, one might wonder as well why English speaking people are still using an extremely weird numeration system when trying to measure distances. You could argue thet it is a matter of multiple units, not numbering, but that is a very weak remark. Numbers are used mainly to measure things.

Other reasons for keeping a system is convenience in a given context. There may be a trade-off between the number of different symbols, or positions on an abacus, and the number of symbol occurencess required to form sufficiently large numbers. Base 2 works with 2 distinct symbols, but has lots of occurences, which may be inconvenient for a material representation. Vigesimal base 20 would require twenty symbols, and very big multiplication tables that people would not remember. But a bi-quinary or quadri-quinary system is a lot more manageable, especially to build abacus. Pure quinary system would probably be even better, but it goes against physiology based habits and intuition. And it is always nice to be able to use our fingers to count with, when we do not know any better.

But that is not all.

One very old and very common system is the sexagesimal system used to measure time and angles (but we know they are related, through Earth rotation). It uses base 60, but does not use 60 symbols as that is far too many. So it relies on another system to represent its synbols (such as the decimal system).

The circle can be divided in 6 parts corresponding to 60 degrees angles, which are the simplest to build with equilateral triangles. Then Each degree is 60 minutes of arc, each divided in 60 seconds.

According to wikipedia

It originated with the ancient Sumerians in the 3rd millennium BC, it was passed down to the ancient Babylonians, and it is still used —in a modified form —for measuring time, angles, and geographic coordinates.

Considering the origin it was a pretty convenient system, at a time when mathematics were hardly entering infancy. Not only is the 60⁰ angle easy to draw, but 60 has a lot of factors, so that it allowed for dividing in many way with integers, without a remainder.

Physiologically, it can be related to a duodecimal-quinary system, base 12 and 5. Base 12 is convenient as it can be used when counting on finger bones of 4 fingers with the thumb of the same hand. Then the fingers of the other hand give the quinary component. And $12\times 5=60$.

But there are other ways to get to 60, such as the vigesimal-ternary system of Babylonians.

Why do we still use the sexagesimal system. I guess we are just used to it, and we may have too many conflicting issues for a change to be fully justified.

It is interesting to note that there is much interplay between numbering systems and unit systems. But this is to be expected since measure is a major role for numbers. This is noticeable in the opposition between the decimal and binary metrics for memory size.

  • 3
    $\begingroup$ That might be because the title says "Why hex, octal or hexadecimal?" $\endgroup$
    – Fizz
    Feb 26 '15 at 11:49
  • 1
    $\begingroup$ @RespawnedFluff Good remark. Then my questionning may extend to the question. I did not mean to say other answers are uninteresting. But a wider view shows better the possible motivations for a variety of systems. It support some of the answers already given. Basically motivations are habit and convenience. But convenience is very much context-dependent. The memory size dichotomy is a recently created one, and it does illustrate the point. $\endgroup$
    – babou
    Feb 26 '15 at 11:56
  • 2
    $\begingroup$ Brevity is a virtue, this question does not require a 1000-word prose, nor is most of it very relevant. You've also failed to answer the question. $\endgroup$
    – dtech
    Feb 26 '15 at 12:31
  • $\begingroup$ "when people count in thousands, ..., this is still considered decimal, because these are powers of 10. So one might wonder why octal or hexadecimal should not be considered just a variation on binary. " Because thousands are just the omission of digits, usually 0's. This is different from base-1000 which would use a 1000 different symbols for every number 0-999. $\endgroup$
    – dtech
    Feb 26 '15 at 12:32
  • 1
    $\begingroup$ @dtech Thank you. I had forgotten the introduction or summary I usually have in front of my answers. And this led me to an important point apparently ignored by other answers. Not every binary word is intended as a numeral. Trying to get a wider view is what helps finding issues. $\endgroup$
    – babou
    Feb 26 '15 at 13:28

Computers understand binary numbers and in binary, the weights of the number are in power of 2, therefore the number of digits to represent a number may be large depending on the number.

Say, 64 in decimal can be represented by 7 bits whereas to represent number 5000 we require 13 bits.

Octal and hexadecimal number system are compact way of representing a binary number.

  • 2
    $\begingroup$ How does this answer [What advantage is there to using a base different from ten or (a power of) two?] - or how else do you interpret Why not stick to [bases 2 and 10]?? $\endgroup$
    – greybeard
    Jan 12 '20 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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