This site is retired and is no longer updated since November 2021. Please visit our new website at https://www.teamscode.org for up-to-date information!
More Number Bases

Vocab Bar
Hexadecimal The numeral system of base 16
Octal The numeral system of base 8

In the last chapter, we covered binary. However, there are also higher numbering base systems.

Hexadecimal is the numeral system of base 16. Its first ten digits are 0-9 and the next six digits are A-F. The Hexadecimal system is calculated the same was a binary and decimal, except with base 16 instead. It is used mainly to represent color and data location.

This table shows the first 16 hexadecimal numbers converted to base 10. The conversion protocol is the same as binary. Once a position reaches a value greater than 15, then you add 1 to the next position and restart at 0. You can see this between 15 and 16. 15 is equal to 15 multiplied by 16 to the 0th power. However 16 is equal to 1 multiplied by 16 to the first power. So the ones position is reset to 0, and the tens position increments by 1:

Base Ten Hexadecimal
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F
16 10
17 11
18 12
... ...

The Octal numeral system is the base 8 system. It uses 0-7 as its set of digits, and it’s calculated in the exact same way as the hexadecimal, decimal, and binary system, except with base 8. For instance, once the value of a certain position reaches the maximum value (in this case 8), it overflows into the next position. Take 4 multiplied by 2, in the chart below. 4 multiplied by 2 is eight, eight can be represented as 1 multiplied by 8 to the power of 1. The Octal numbering system was used widely to transcribe data locations and instruction, but as the data became larger, those uses fell to hexadecimal.

This table shows the octal multiplication chart:

x 1 2 3 4 5 6 7 10
1 1 2 3 4 5 6 7 10
2 2 4 6 10 12 14 16 20
3 3 6 11 14 17 22 25 30
4 4 10 14 20 24 30 34 40
5 5 12 17 24 31 36 43 50
6 6 14 22 30 36 44 52 60
7 7 16 25 34 43 52 61 70
10 10 20 30 40 50 60 70 100

Lesson Quiz

Convert the following numbers to base 10.

1. Oct: 76

a. 54
b. 62
c. 68
d. 76

2. Oct: 135

a. 89
b. 90
c. 92
d. 93

3. Oct: 427

a. 279
b. 283
c. 284
d. 285

4. Hex: 8f

a. 143
b. 144
c. 145
d. 146

5. Hex: 7a

a. 120
b. 121
c. 122
d. 123

Written by Jason Zhang

Notice any mistakes? Please email us at learn@teamscode.com so that we can fix any inaccuracies.