For a Cisco exam you need to be able to very quickly convert between Decimal, Binary and Hexadecimal and back again.

Being able to recreate the below tables will greatly help will this

Decimal to Binary and Back Again

128 64 32 16 8 4 2 1

A decimal number for example 172 is represented in binary as 1 byte which I am sure we all know 1 byte is 8 bits (binary digits). So using the above table if I want to work out what 172 is in binary  I simply need to “turn on” the bits from left to right until I make 172.

Example 1: What is 172 in binary?

128 64 32 16 8 4 2 1
 1  0  1  0 1  1 0  0

128 + 32 + 8 + 4 = 172

Example 2: What is 255 in binary?

128 64 32 16 8 4 2 1
 1  1  1  1 1  1 1  1

128 + 64 +32 +16 + 8 +4 +2 +1 = 255

Example 3: What is 192 in binary?

128 64 32 16 8 4 2 1
 1  1  0  0 0  0 0  0

128 + 64 = 192

Decimal to Hexadecimal and Back Again

The easiest way to convert between decimal and hexadecimal if to go to IP first, and being able to reproduce the below table during the exam helps, so start learning how to count to 15 in binary!

Decimal Binary Hexidecimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

As you can see a hexadecimal number represents 4 bits, lets go so converting

Example1: Decimal 176 to Hexadecimal

1) The first thing we need to do is convert 176 to binary using the same method we used before

176 = 10110000

2) A hexadecimal digit can only only be 4 bits so the next step is to break our binary result in two

1011 0000

3) Now we simply use the above table

1011 = B

0000 = 0

4) The answer is

176 = 1011000 = 0xB0

The 0x just lefts everyone know this a hexadecimal number.

Example 2: Decimal 224 to Hexadecimal

1) 224 = 1110000 (128 + 64 +32)

2) 1110 0000

3) 1110 = E        0000 = 0

4) 224 = 11100000 = 0xE0

Example 3: 0xF7 to Decimal

This time we just do things in reverse

1) F = 1111         7 = 0111

2) 11110111 = 247 (128 + 64 +32 +16 + 4 + 2 + 1 or 255 – 8)

3) The answer is 0xF7 = 11110111 = 247

Practice Makes Perfect!