# Bits/Bytes/Binary/Hexadecimal Explained and Converter

# Binary/Hexadecimal Converter

Type a number in any box:

## What is Binary Digit

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.

number of bits | possible distinct values |
---|---|

1 | 2 |

2 | 4 |

3 | 8 |

4 | 16 |

5 | 32 |

6 | 64 |

7 | 128 |

8 | 256 |

## What is Bit

A bit is a single binary digit. It's has 2 possible values, usually represented as 1 or 0. With 1 usually means on, 0 is off. Or, 1 is true, 0 is false.

## What is Byte

A byte is eight binary digits, as a unit. For example:

`00000000`

→ minimal value`00110000`

`11011101`

`00101001`

`01000111`

`11111111`

→ maximal value

It has a total of 256 possible values. (2^8 = 256) Value are considered to be 0 to 255.

Computer files, data, are all ultimately converted to a sequence of bytes, to be processed by CPU or stored on memory devices.

## 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 | possible distinct values |
---|---|

1 | 16 |

2 | 256 |

3 | 4096 |

4 | 65536 |