# Comparing Decimal, Hexadecimal, and Binary

If you’re working on a certification exam such as the CompTIA A+, Network+, or Security+ certification, you might need to review your knowledge of decimal, hexadecimal, and binary numbering systems. This is basic knowledge, but it’s important. If you haven’t used these numbering systems in a while, they might be a little foggy.

## Decimal

Decimal numbers use a base of ten and include the numbers 0 to 9.

## Hexadecimal

Hexadecimal numbers use a base of 16 and include the numbers 0 to 9 and the characters A to F.

## Binary

Binary numbers use a base of 2 and include only the numbers 0 and 1. The following table shows how binary is raised to different powers to give different values in a four bit binary number.

2^3 | 2^2 | 2^1 | 2^0 |
---|---|---|---|

8 | 4 | 2 | 1 |

- Any number raised to the power of 0 is 1 so 2^0 is 1.
- Any number raised to the power of 1 is itself so 2^1 is 2
- 2 raised to the power of 2 is the same as 2 x 2 (2 squared or 4)
- 2 raised to the power of 3 is the same as 2 x 2 x 2 (2 cubed or 8)

## Comparing Numbers

The following table compares each of these number systems side by side.

Decimal | Hexadcimal | Binary | |||
---|---|---|---|---|---|

2^3 | 2^2 | 2^1 | 2^0 | ||

0 | 0 | 0 | 0 | 0 | 0 |

1 | 1 | 0 | 0 | 0 | 1 |

2 | 2 | 0 | 0 | 1 | 0 |

3 | 3 | 0 | 0 | 1 | 1 |

4 | 4 | 0 | 1 | 0 | 0 |

5 | 5 | 0 | 1 | 0 | 1 |

6 | 6 | 0 | 1 | 1 | 0 |

7 | 7 | 0 | 1 | 1 | 1 |

8 | 8 | 1 | 0 | 0 | 0 |

9 | 9 | 1 | 0 | 0 | 1 |

10 | A | 1 | 0 | 1 | 0 |

11 | B | 1 | 0 | 1 | 1 |

12 | C | 1 | 1 | 0 | 0 |

13 | D | 1 | 1 | 0 | 1 |

14 | E | 1 | 1 | 1 | 0 |

15 | F | 1 | 1 | 1 | 1 |

## Try This

See if you convert the following hexadecimal numbers to four binary bits:

- 5
- 7
- B
- E

See if you convert the following decimal numbers to hexadecimal:

- A
- C
- D
- F

See if you convert the following decimal numbers to four binary bits:

- 4
- 8
- 9
- 14

## Other Resources

If you plan on taking the A+, Network+ or Security+ exams to give yourself the CompTIA Trio, check out these resources:

### A+

### Network+

### Security+

## Conversion Answers

The following hexadecimal numbers converted to four binary bits are:

- 5 is 0101
- 7 is 0111
- B is 1011
- E is 1110

The following hexadecimal numbers converted to decimal are:

- A is 1010
- C is 1100
- D is 1101
- F is 1111

The following decimal numbers converted to four binary bits are:

- 4 is 0100
- 8 is 1000
- 9 is 1001
- 14 is 1110