# Binary/Hexadecimal Converter

Type a number in any box:

Result: (press enter to show)

## Binary Digit Explained

Binary digit system is a notation to repsent numbers.

In decimal system, we use 10 symbols, 0 to 9. When a number is larger than 9, we start over by placing a new digit on the left. For example, 10 is 1 on left and 0 on right.

A binary number notation uses just 2 symbols.

A binary digit is either 1 or 0. For example,
`1001`

is four binary digits.

A binary digit is also called **bit**. So, `1001`

is 4 bits.

Here's a table showing decimal and binary:

decimal | binary |
---|---|

0 | 0 |

1 | 1 |

2 | 10 |

3 | 11 |

4 | 100 |

Binary digits is used in computers, because electronics deal with on/off signals, most easily represented by binary digits.

### Possible Size in Binary Number

If a binary number has n digits, it has 2^n possible values.

bits | total values |
---|---|

1 | 2 |

2 | 4 |

3 | 8 |

4 | 16 |

## Hexadecimal Digit Explained

In hexadecimal notation, we represent numbers using 16 symbols.

Each digit is any 0 to 9 and A to F (sometimes lowercase).

Here's examples:

decimal | binary | hexadecimal |
---|---|---|

0 | 0 | 0 |

1 | 1 | 1 |

2 | 10 | 2 |

3 | 11 | 3 |

4 | 100 | 4 |

5 | 101 | 5 |

6 | 110 | 6 |

7 | 111 | 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 |

16 | 10000 | 10 |

17 | 10001 | 11 |

18 | 10010 | 12 |

19 | 10011 | 13 |

20 | 10100 | 14 |

21 | 10101 | 15 |

22 | 10110 | 16 |

23 | 10111 | 17 |

24 | 11000 | 18 |

25 | 11001 | 19 |

26 | 11010 | 1a |

27 | 11011 | 1b |

28 | 11100 | 1c |

29 | 11101 | 1d |

30 | 11110 | 1e |

31 | 11111 | 1f |

Hexadecimal is used often in computing, because each hexadecimal digit is equivalent to 4 binary digits, so is shorter and more readable.

- 1 hexadecimal digit has the same number of possible values as 4 bits.
- 2 hexadecimal digit has the same number of possible values as 8 bits.
- 3 hexadecimal digit has the same number of possible values as 12 bits.
- 4 hexadecimal digit has the same number of possible values as 16 bits.

So, 4 bits can be written as 1 hexadecimal. 8 bits can be written as 2 hexadecimal, etc.

### Possible Size in Hex Number

If a Hex number has n digits, it has 16^n possible values.

number of digits | total values |
---|---|

1 | 16 |

2 | 256 |

3 | 4096 |

4 | 65536 |