# Number Systems

When working with IT it is important to be familiar with the binary numbers, Hex numbers and Octal.

 Decimal Binary Hexadecimal Octal Binary to Octal Binary to Hex

Decimal (base 10)
Numbers are made up using ten digits 0,1,2,3,4,5,6,7,8,9

The place values are shown below

100=1
101=10
102=10 * 10 =100
103=10* 10 * 10 =1000
104=10 * 10 * 10 * 10 =10000
105=10 * 10 * 10 * 10 * 10 =100000

BINARY (base 2)

Numbers are made up using only two digits 0,1

The place values are shown below

20=1
21=2
22=2 * 2 =4
23=2 * 2 * 2 =8
24=2 * 2 * 2 * 2 = 16
25=2 * 2 * 2 * 2 * 2 = 32
26=2 * 2 * 2 * 2 * 2 * 2 = 64
27=2 * 2 * 2 * 2 * 2 * 2 * 2 = 128

The following pattern for solving binary numbers to decimal numbers and decimal numbers to binary numbers should be used. Always remember to calculate from right to left instead of left to right. Also notice that each place doubles in value from right to left.

2726252423222120
12864321684 21

The above should be memorized. Later this will be important to remember when figuring out the number of subnets and hosts per subnets. Therefore, this skill must be practiced and reinforced as often as possible. Here are a few sample problems.

Example 1 (binary to decimal)

11001011 = 128 + 64 + 8 + 2 + 1 = 203

2726252423222120
128 64321684 21
1 10010 11

By writing out the chart and placing the 1's and 0's under the proper place in the chart, all that is left is to add up the place values that have 1's under them and the total will be the decimal number value.

Example 2 (binary to decimal)

01011110 = 64 + 16 + 8 + 4 + 2 = 94
2726252423222120
12864 321684 21
01 0111 10

To convert decimal numbers to binary numbers, place 1's in the place values until all the place values with 1's add up to the total. If any numbered place adds a value that is larger than the decimal number, 0's should be placed in those place values.

Example 3 (decimal to binary)

138 = 10001010 or

2726252423222120
128 64321684 21
1 00010 10

Another method for converting decimal numbers to binary numbers is the remainder method. Divide the decimal number by 2 and place write down a 1 if there is a remainder or a 0 if there is no remainder. Then divide the answer by 2 and write down a 1 if there is a remainder or a 0 if there is no remainder. The division process continues until there are 8 bits or place values of 1's or 0's. Be sure to write the 1's and 0's down in reverse order from right to left.

Example 4 (decimal to binary)

218 = 11011010

218÷2=109 remainder0
109÷2=54 remainder1
54÷2=27 remainder0
27÷2=13 remainder1
13÷2=6 remainder1
6÷2=3 remainder0
3÷2=1 remainder1
1÷2=0 remainder1

The work can be checked by placing the 1's and 0's back into the chart and adding up the place values that have 1's.

Checking the answer (218) 128 + 64 + 16 + 8 + 2

2726252423222120
128 64321684 21
1 10110 10

# 16

From Greek, hexadecimal is a word meaning "sixteen."

Hexa=6 (hexagonal, hexagram, etc.)
Decimal=10

In the hexadecimal system, 6 letters are added to the standard 0-9 Arabic Numerals, to give you a numbering system with base 16, instead of base ten.

Numbers are made up using sixteen digits 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F

The place values are shown below

160=1
161=16
162=16 * 16 = 256
163=16 * 16 * 16 = 4069

Count from 0 to 9, then count A, B, C, D, E, F.

Then you reach 10 (hexadecimal 10, which corresponds to decimal 16).

Count again: 11, 12, 13, 14, 15, 16, 17, 18 , 19, then use 1 and a letter: 1A, 1B, 1C, 1D, 1E, 1F.

Then you reach 20 (hexadecimal 20, which corresponds to decimal 32).

This continues forever. For instance,

B0 in hexadecimal = 176 in decimal:
(B[hex] * 16[decimal]) + (0 * 1).
Since B is 11 in decimal, this equation becomes
(11 * 16) + (0 * 1) = 11 * 16 = 176.

162 161 160
256 16 1
0 B 0
11*16 0

D4 in hexadecimal = 212 in decimal:
(D[hex] * 16[decimal]) + (4 * 1).
Since D is 13 in decimal, this equation becomes
(13 * 16) + (4 * 1) = 208 + 4= 212.

162 161 160
256 16 1
0 D 4
13*16 4

Here are a few more examples

 Hex. = Hex. equation = Decimal equation = Decimal C8 = (C * 16) + (8 * 1) = (12 * 16) + (8 * 1) = 200 FF = (F * 16) + (F * 1) = (15 * 16) + (15 * 1) = 255 100 = (1 * 16 * 16) + (0 * 16) + (0 * 1) = (1 * 16 * 16) + (0 * 16) + (0 * 1) = 256

Example 6 (decimal to hex)

218 in decimal = DA in hexadecimal

218÷16 = 13 D
218-(13*16) =218 - 208 = 10 A

Example 7 (decimal to hex)

178 in decimal = B2 in hexadecimal:
178 = (11 * 16) + (2 * 1) =
(B * 16[hex.]) + (2 * 1) =
B2.

Here are a few more examples

 Decimal = Decimal equation = Hex. equation = Hex. 48 = (3 * 16) + (0 * 1) = (3 * 10) + (0 * 1) = 30 513 = (2 * 16 * 16) + (0 * 16) + (1 * 1) = (2 * 10 * 10) + (0 * 10) + (1 * 1) = 201 1,000 = (3 * 16 * 16) + (14 * 16) + (8 * 1) = (3 * 10 * 10) + (E * 10) + (8 * 1) = 3E8

Here are some more numbers in hexadecimal and decimal.
Try converting one form to the other, and back again, until you are comfortable with the process.

 Hex. Dec. . Hex. Dec. . Hex. Dec. 0 0 10 16 C8 200 1 1 11 17 F0 240 2 2 19 25 FF 255 9 9 1A 26 100 256 A 10 1B 27 3E8 1,000 B 11 1F 31 1000 4,096 C 12 20 32 10000 65,536 D 13 32 50 100000 1,048,576 E 14 64 100 FFFFFF 16,777,215 F 15 A0 160 1000000 16,777,216

1. You can store more information in the same space. In a hex code with two digits you can express the numbers 0 through 255. In a decimal code with two digits you can count from 0 to 99.

2. Hexadecimal (base 16) converts easily to binary (base 2), which is used by computers. A two digit hexadecimal number can range from 0 to 255, which can be expressed in eight digits of binary code (one byte).

Octal (base 8)

# 8

Octa=6 (Octagonal, Octagram, Octave, etc.)

INumbers are made up using eight digits 0,1,2,3,4,5,6,7

The place values are shown below

80=1
81=8
82=8 * 8 = 64
83=8 * 8 * 8 = 512
84=8 * 8 * 8 * 8 =4096
8 5=8 * 8 * 8 * 8 =32768

Example 1 (Octal to Decimal)

1025 in octal = 533 in decimal
(1 * 512) + (0*64) + (2 * 8) + (5 * 1)

85 84 83 82 81 80
32768 4096 512 64 8 1
0 0 1 0 2 5

Example 2 (Octal to Decimal)

25170 in octal = 10872 in decimal
(2 * 4096) + (5 * 512) + (1*64) + (7 * 8) + (0 * 1)

85 84 83 82 81 80
32768 4096 512 64 8 1
0 2 5 1 7 0

# Now the Easy Stuff!!

Binary to Octal

If we compare the place value of octal to binary you should see a pattern

29 28 27 26 25 24 23 22 21 20
512 256 128 64 32 16 8 4 2 1
83 82 81 80
512 64 8 1

Every group of three binary matches one octal.

Example 1
The binary number 101011 = 53 octal

 101 011 5 3

Example 2
Binary 10010111 = 227 octal

 10 010 111 2 2 7

Example 3
Binary 101011100 = 534 octal

 101 011 100 5 3 4

If we compare the place value of octal to binary you should see a pattern

29 28 27 26 25 24 23 22 21 20
512 256 128 64 32 16 8 4 2 1
162 161 160
256 16 1

Every group of four binary matches one hex.

Example 1
The binary number 101001 = 29 hex

 10 1001 2 9

Example 2
Binary 10010111 = 97 hex

 1001 0111 9 7

Example 3
Binary 01011010 = 5A hex

 0101 1010 5 10 5 A

Example 3
Binary 10111110 = BE hex

 1011 1110 11 14 B E