Base Number Systems
Why learn about base number systems?
The number system used by people everyday is the base10 decimal number system. However, because of how they work, computers actually use the base2 binary number system to represent data internally. Binary numbers can be quite large and difficult to read, often the base16 hexadecimal number system is used as a shorthand for binary numbers. The base8 octal number system is sometimes used as a shorthand for binary numbers as well. In order to work with computers, it's important to understand the binary (base2), hexadecimal (base16), and to a lesser extent, octal (base8) number systems and how to convert between them and decimal (base10).
| Number System | Common Use |
| Decimal (Base10) | Used everyday by people |
| Binary (Base2) | Used internally by computers |
| Hexadecimal (Base16) | Shorthand for binary |
| Octal (Base8) | Shorthand for binary |
The base number determines the number that the system is based upon (e.g., the base10 decimal number system is based upon the number 10). The base number determines two things:
| Number System | Digits | 1st Four Columns | Column Conversion to Decimal | ||||
| Decimal (Base10) | 0-9 | or | 103 | 102 | 101 | 100 | For Example: (1x1000)+(0x100)+(1x10)+(0x1) = 101010 |
| 1000 | 100 | 10 | 1 | ||||
| Binary (Base2) | 0-1 | or | 23 | 22 | 21 | 20 | Binary 10102
converted to Decimal equals (1x8)+(0x4)+(1x2)+(0x1) = 1010 |
| 8 | 4 | 2 | 1 | ||||
| Hexadecimal (Base16) | 0-9,A-F | or | 163 | 162 | 161 | 160 | Hexadecimal 101016
converted to Decimal equals (1x4096)+(0x256)+(1x16)+(0x1) = 411210 |
| 4096 | 256 | 16 | 1 | ||||
| Octal (Base8) | 0-7 | or | 83 | 82 | 81 | 80 | Octal 10108
converted to Decimal equals (1x512)+(0x64)+(1x8)+(0x1) = 52010 |
| 512 | 64 | 8 | 1 | ||||
Note that the base of a number is sometimes indicated by a
subscripted number following the actual number:
Decimal 10 = 1010 Binary 10 = 102 Hexadecimal
10 = 1016 Octal 10 = 108
Generally, decimal numbers have no indication of base because that is what people are most familiar with. Computer and network systems use a variety of additional indicators to represent the base of a number (e.g., hexadecimal numbers are often preceded by "0x"). Sometimes the base of the number is not indicated, but assumed as standard (e.g., a MAC address is represented in hexadecimal).
How does a base number system work?
| Number System | Digits | Counting from Zero |
| Decimal (Base10) | 0-9 | 0,1,2,3,4,5,6,7,8,9,10... |
| Binary (Base2) | 0-1 | 0,1,10,11,100,101,110,111,1000... |
| Hexadecimal (Base16) | 0-9,A-F | 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10... |
| Octal (Base8) | 0-7 | 0,1,2,3,4,5,6,7,10... |
The base of a number system defines how many digits can be used. The first digit used in a number system is always zero. When the highest digit is reached in a column, one is added to the next column and the columns to the right start at zero again.
Counting in Decimal (Base10)
Counting in base10 (10 digits available, 0-9) would be as
follows:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, when 9 is
reached in the 1st column, 1 is added to the next column and the right
column starts at zero again
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
when 9 is reached in the 1st column, 1 is added to the next column and
the right column starts at zero again
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, etc.
This continues:
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
when 99 is reached in the 1st two columns, 1 is added to the third
column and the right columns start at zero again
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
when 9 is reached in the 1st column, 1 is added to the 2nd column and
the right column starts at zero again
110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
etc.
We are familiar with how this works in the base10 decimal number system because we use it all the time. This is also how it works in other base number systems, but the number of digits available is different along with the decimal value of the numbers.
Counting in Binary (Base2)
Counting in base2 (2 digits available, 0-1) would be as
follows:
0, 1, when 1 is reached in the 1st
column, 1 is added to the next column and the right column starts at
zero again
10, 11, when 11 is reached in the 1st two
columns, 1 is added to the next column and the right columns start at
zero again
100, 101, 110, 111, when 111 is reached
in the 1st three columns, 1 is added to the next column and the right
columns start at zero again
1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111,
10000, etc.
Note that only the two digits 0 and 1 are used in the base2
binary number system.
Counting in Hexadecimal (Base16)
Counting in base16 (16 digits available, 0-9 and the letters
A-F) would be as follows:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F,
when F is reached in the 1st column, 1 is added to the next column and
the right column starts at zero again
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B,
1C, 1D, 1E, 1F,
when F is reached in the 1st column, 1 is added to the next column and
the right column starts at zero again
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2A, 2B,
2C, 2D, 2E, 2F, etc.
This continues:
F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, FA, FB,
FC, FD, FE, FF,
when FF is reached in the 1st two columns, 1 is added to the third
column and the right columns start at zero again
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
10A, 10B, 10C, 10D, 10E, 10F,
when F is reached in the 1st column, 1 is added to the 2nd column and
the right column starts at zero again
110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
11A, 11B, 11C, 11D, 11E, 11F, etc.
Note that the letters A-F are used to represent the decimal values
10-15 because the base16 number system requires six
additional digits beyond the ten digits 0-9.
Counting in Octal (Base8)
Counting in base8 (8 digits available, 0-7) would be as
follows:
0, 1, 2, 3, 4, 5, 6, 7,
when 7 is reached in the 1st column, 1 is added to the next column and
the right column starts at zero again
10, 11, 12, 13, 14, 15, 16, 17,
when 7 is reached in the 1st column, 1 is added to the next column and
the right column starts at zero again
20, 21, 22, 23, 24, 25, 26, 27, etc.
This continues:
70, 71, 72, 73, 74, 75, 76, 77,
when 77 is reached in the 1st two columns, 1 is added to the third
column and the right columns start at zero again
100, 101, 102, 103, 104, 105, 106, 107,
when 7 is reached in the 1st column, 1 is added to the 2nd column and
the right column starts at zero again
110, 111, 112, 113, 114, 115, 116, 117, etc.
Note that the digits 8 and 9 cannot be used in a base8
number system because the base number determines how many digits the
system can use. In the case of a base8 number system, the
eight digits used are 0-7 and NOT 0-9 as in the base10
decimal number system we're used to.
To determine the value of each column in a base number system, raise the base to the 0 power in the rightmost column and add 1 to the power for each column as you move to the left.
| ... | Base7 | Base6 | Base5 | Base4 | Base3 | Base2 | Base1 | Base0 | |
| Column | ... | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
Column Values in Decimal (Base10) For the base10 decimal number system, the 1st eight columns would look like the following:
| 107 | 106 | 105 | 104 | 103 | 102 | 101 | 100 | |
| Column | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
100, 101, 102, 103, 104,
105, 106, and 107 are powers or
exponents of ten. In general:
Any number raised to the power of 0 is 1 (e.g., 100 = 1)
Any number raised to the power of 1 is the number itself (e.g., 101
= 10)
Any number raised to the power beyond 1 is the number multiplied by
itself that many times
(e.g., 102 = 10 x 10 = 100, 103 = 10 x 10 x 10 =
1000, 104 = 10 x 10 x 10 x 10 = 10000, etc.)
The values for the 1st eight columns in the base10 decimal
number system would be:
| 10,000,000 | 1,000,000 | 100,000 | 10,000 | 1,000 | 100 | 10 | 1 | |
| Column | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
The base10 decimal number 12,345,678
would be equivalent to:
(1x10,000,000)+(2x1,000,000)+(3x100,000)+(4x10,000)+(5x1,000)+(6x100)+(7x10)+(8x1)
| 107 | 106 | 105 | 104 | 103 | 102 | 101 | 100 | = 12,345,678 |
| 10,000,000 | 1,000,000 | 100,000 | 10,000 | 1,000 | 100 | 10 | 1 | |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| The rightmost or 1st column indicates 8 ones. | 8 | |
| The 2nd column indicates 7 tens. | + | 70 |
| The 3rd column indicates 6 hundreds. | + | 600 |
| The 4th column indicates 5 thousands. | + | 5,000 |
| The 5th column indicates 4 ten-thousands. | + | 40,000 |
| The 6th column indicates 3 hundred-thousands. | + | 300,000 |
| The 7th column indicates 2 millions. | + | 2,000,000 |
| The 8th column indicates 1 ten-million. | + | 10,000,000 |
| Adding these values together produces the number | 12,345,678 |
Column Values in Binary (Base2) For the base2 binary number system, the 1st eight columns would look like the following:
| Power | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Column | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
The decimal equivalent of the base2 binary number 101010102 would be:
(1x128)+(0x64)+(1x32)+(0x16)+(1x8)+(0x4)+(1x2)+(0x1)
= 170
| 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | = 170 |
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
| The rightmost or 1st column indicates 0 ones. | 0 | |
| The 2nd column indicates 1 two. | + | 2 |
| The 3rd column indicates 0 fours. | + | 0 |
| The 4th column indicates 1 eight. | + | 8 |
| The 5th column indicates 0 sixteens. | + | 0 |
| The 6th column indicates 1 thirty-two. | + | 32 |
| The 7th column indicates 0 sixty-fours. | + | 0 |
| The 8th column indicates 1 one-hundred-twenty-eight. | + | 128 |
| Adding these values together produces the decimal value | 170 |
Column Values in Hexadecimal (Base16) For the base16 hexadecimal number system, the 1st four columns would look like the following:
| Power | 163 | 162 | 161 | 160 |
| Value | 4096 | 256 | 16 | 1 |
| Column | 4th | 3rd | 2nd | 1st |
The decimal equivalent of the base16 hexadecimal number 1A2F16 would
be:
(1x4096)+(10x256)+(2x16)+(15x1) = 6703
| 163 | 162 | 161 | 160 | = 6703 |
| 4096 | 256 | 16 | 1 | |
| 1 | A | 2 | F |
| The rightmost or 1st column indicates 15 ones. | 15 | |
| The 2nd column indicates 2 sixteens. | + | 32 |
| The 3rd column indicates 10 two-hundred-fifty-sixes. | + | 2560 |
| The 4th column indicates 1 four-thousand-ninety-six. | + | 4096 |
| Adding these values together produces the decimal value | 6703 |
Column Values in Octal (Base8) For the base8 octal number system, the 1st four columns would look like the following:
| Power | 83 | 82 | 81 | 80 |
| Value | 512 | 64 | 8 | 1 |
| Column | 4th | 3rd | 2nd | 1st |
The decimal equivalent of the base8 octal number 12348 would be:
(1x512)+(2x64)+(3x8)+(4x1) = 668
| 83 | 82 | 81 | 80 | = 668 |
| 512 | 64 | 8 | 1 | |
| 1 | 2 | 3 | 4 |
| The rightmost or 1st column indicates 4 ones. | 4 | |
| The 2nd column indicates 3 eights. | + | 24 |
| The 3rd column indicates 2 sixty-fours. | + | 128 |
| The 4th column indicates 1 five-hundred-twelve. | + | 512 |
| Adding these values together produces the decimal value | 668 |
Differences in column values between
number systems
To give you an idea of the differences
between base10
decimal and other base systems, below are listed the decimal, binary,
hexadecimal, and octal representations of the decimal value 172.
| Decimal Base10 |
100 | 10 | 1 |
Decimal Base10 Value = (1 x 100) + (7 x 10) + (2 x 1) = 172 |
|||||
| 102 | 101 | 100 | |||||||
| Digits (0-9) | 1 | 7 | 2 | ||||||
| Binary Base2 |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Decimal Base10 Value = (1 x 128) + (1 x 32) + (1 x 8) + (1 x 4) = 172 |
| 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | ||
| Digits (0-1) | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | |
| Hexadecimal Base16 |
256 | 16 | 1 |
Decimal Base10 Value = (0 x 256) + (10 x 16) + (12 x 1) = 172 |
|||||
| 162 | 161 | 160 | |||||||
| Digits (0-F) | 0 | A | C | ||||||
| Octal Base8 |
64 | 8 | 1 |
Decimal Base10 Value = (2 x 64) + (5 x 8) + (4 x 1) = 172 |
|||||
| 82 | 81 | 80 | |||||||
| Digits (0-7) | 2 | 5 | 4 | ||||||