Number bases

Cards (8)

  • A number base is the number of digits or combinations of digits a system uses to represent numbers.
    To distinguish between number bases, we often use a subscript next to the number.
  • In denary, we use 10 digits (0 – 9) to represent a number; each digit in a number has a place value, or weight, that is a power of 10.
  • Computers use electronic circuits that function as switches, which can be either in an on or an off state. Representing any type of information in a computer relies on processing and storing these two distinct states. This has led to the use of a number system that has only two digits: a 0 that corresponds to the off state of a switch, and a 1 that corresponds to the on state. This number system is called binary.
  • The binary (or base-2) number system follows the same principles as the familiar denary (base-10) number system. In binary each digit has a place value or weight that is a power of 2.
  • Another commonly used number system in computer science is hexadecimal (or base-16, or hex). This system uses 16 digits, i.e. sixteen unique symbols are combined to make up all other numbers. There are only ten symbols in the denary number system (0–9), and so in hexadecimal, a further six symbols (the characters A–F) are used to represent the remaining six digits.
    The sixteen digits that form the base of the hexadecimal system correspond to the denary values 0–15. Each hex digit is equivalent to four binary digits.
  • Similarly to denary and binary, in hexadecimal each digit has a place value or weight that is a power of 16.
  • There are various implementations where representing a binary sequence in hexadecimal is preferred over its binary equivalent. The main reason for this is that long sequences of binary digits are hard to read and understand for humans. Programmers often use hexadecimal as a shorthand for binary.
  • The colours on a web page are represented in binary by 24-bit codes, i.e. combining 8 bits for a shade of red, 8 bits for a shade of green, and 8 bits for a shade of blue. In hexadecimal, the same colour can be represented by only 6 hexadecimal digits. For example, the colour orange can be depicted as FFA500 instead of 111111111010010100000000.