The Binary system

The binary system is a numbering system that uses only two digits: 0 and 1. This system is sometimes called base 2.

Numbers are written as sequences of 0s and 1s, called bits. For example, the binary number 1101.

The binary system is widely used in computer science and digital electronics, as it provides a simple way to represent data using electrical signals that can be either on or off (0 or 1).

Binary counting

When counting in Binary, we start at the right-most bit (least significant bit) and move to the left by powers of 2 adding the values as we go.

So for example, the binary 00001101 gives a decimal value of 13:

128 (27)64 (26)32 (25)16 (24)8 (23)4 (22)2 (21)1 (20)
00001101

8+4+1 = 13

A common Binary representation in computing uses 8-bits (known as a Byte) and this can have a possible 256 Binary values

00000000 = 0

11111111 = 255

The Hexadecimal system

The hexadecimal (Hex) system, also known as base 16, is a numbering system that uses 16 digits to represent numbers.

It uses the digits 0-9 for the first ten values, and then uses the letters a-f for the remaining six values.

Hexadecimal counting

When counting in Hex , we start at the right-most bit (least significant bit) and move to the left by powers of 16 adding the values as we go.

So for example the Hex 2b gives a decimal value of 43, which in Binary would be 00101011:

16 (161)1 (160)
2b

(16×2) + 11 = 43

The hexadecimal system is commonly used in computing and digital electronics because it provides a convenient way to represent binary numbers.

Since each hexadecimal digit corresponds to four binary digits (bits), it is easy to convert between the two systems. For example, the binary number 11011010 can be represented as the hexadecimal number DA.

The Hex value ff is the same as the Binary 11111111, which in Decimal is 255.

Removing ambiguity

When writing numbers in computing, it is important to specify which numbering system is in use (Binary, Hex, Decimal, etc.)

For example, the value 10 could mean 3 different figures:

  • Decimal 10
  • Binary 2
  • Hex 16

To avoid confusion it is common to see values written thus:

  • Decimal 10
  • Binary 00000010
  • Hex 0x10