No history yet

Base Relations

The Power of Two Connection

Hexadecimal (base-16) and octal (base-8) aren't just random number systems used in computing. They have a special, direct relationship with binary (base-2) because their bases are powers of two. Specifically, $16 = 2^4$ and $8 = 2^3$. This mathematical link is the key to their utility.

This power-of-two relationship means every hexadecimal digit can be perfectly represented by a group of four binary digits, and every octal digit by a group of three. This creates a clean, simple shorthand for reading and writing long binary strings, which is why developers and engineers use them so often.

Hexadecimal's Four-Bit Friendship

Because $16 = 2^4$, there's a one-to-one mapping between each of the 16 hexadecimal digits (0-9, A-F) and every possible four-digit binary number. A group of four bits is often called a (or sometimes nybble), a playful term for half a byte.

This makes converting from hex to binary incredibly simple. You don't need to do any complex math. You just swap each hex digit for its corresponding four-bit binary group.

Hex DigitBinary (4-bit)
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
A1010
B1011
C1100
D1101
E1110
F1111

For example, let's convert the hexadecimal number 9B3D to binary. We just look up each digit in the table and line them up:

9 → 1001 B → 1011 3 → 0011 D → 1101

So, 9B3D in hex is 1001101100111101 in binary.

Lesson image

Octal's Three-Bit Trio

The same principle applies to the octal system. Since its base is 8, and $8 = 2^3$, every octal digit (0-7) corresponds to a unique three-bit binary number. This makes octal another convenient shorthand for binary, although it's less common today than hexadecimal.

One historical use for octal was in file permissions on , where a three-digit octal number could cleanly represent the read, write, and execute permissions for the owner, group, and others.

Octal DigitBinary (3-bit)
0000
1001
2010
3011
4100
5101
6110
7111

Converting the octal number 571 to binary follows the same substitution pattern:

5 → 101 7 → 111 1 → 001

So, 571 in octal is 101111001 in binary.

Binary as the Bridge

This direct mapping makes binary an efficient bridge for converting between hexadecimal and octal. Instead of going through the tedious process of converting hex to decimal and then decimal to octal, you can simply use binary as an intermediary step. This method avoids multiplication and division, relying only on substitution and regrouping.

Let's convert the hexadecimal number E5 to octal.

Step 1: Convert hex to binary. First, we convert each hexadecimal digit to its 4-bit binary equivalent.

E1110 50101

Combining them gives us the binary string 11100101.

Step 2: Regroup binary for octal. Next, we take that binary string and regroup it into sets of three bits, starting from the right-hand side.

11 100 101

The leftmost group only has two digits. To make it a full 3-bit group, we pad it with a leading zero. This doesn't change its value.

011 100 101

Step 3: Convert binary groups to octal. Finally, we convert each 3-bit group into its corresponding octal digit.

011 → 3 100 → 4 101 → 5

Therefore, E5 in hexadecimal is 345 in octal. This binary-bridging method is faster and less error-prone than converting through base-10.

Quiz Questions 1/5

Why are hexadecimal and octal number systems especially useful in computing?

Quiz Questions 2/5

A group of four binary digits, which corresponds to a single hexadecimal digit, is often called a ________.