# Decimal to hex binary converter

# Decimal to hex binary converter

A Decimal-to-Hex/Binary Converter is a tool that converts decimal numbers to either their hexadecimal or binary representation.

Here’s how you can convert a decimal number to its hexadecimal and binary representation:

**Decimal to Hexadecimal conversion:**- Divide the decimal number by 16.
- Write down the remainder (in hex) as the least significant digit of the hexadecimal representation.
- Divide the quotient by 16 and repeat until the quotient is 0.
- Write down the hex digits in reverse order to get the final hexadecimal representation.

**For example, let’s convert the decimal number 256 to hexadecimal:**- 256 ÷ 16 = 16 remainder 0, so the least significant digit is 0 (in hex).
- 16 ÷ 16 = 1 remainder 0, so the next digit is 0.
- 1 ÷ 16 = 0 remainder 1, so the most significant digit is 1.
- The final hexadecimal representation is 100.

### Decimal to Binary conversion:

- Divide the decimal number by 2.
- Write down the remainder (either 0 or 1) as the least significant bit of the binary representation.
- Divide the quotient by 2 and repeat until the quotient is 0.
- Write down the bits in reverse order to get the final binary representation.

For example, let’s convert the decimal number 45 to binary:

- 45 ÷ 2 = 22 remainder 1, so the least significant bit is 1.
- 22 ÷ 2 = 11 remainder 0, so the next bit is 0.
- 11 ÷ 2 = 5 remainder 1, so the next bit is 1.
- 5 ÷ 2 = 2 remainder 1, so the next bit is 1.
- 2 ÷ 2 = 1 remainder 0, so the next bit is 0.
- 1 ÷ 2 = 0 remainder 1, so the most significant bit is 1.
- The final binary representation is 101101.

Therefore, the hexadecimal representation of decimal number 256 is 100, and the binary representation of decimal number 45 is 101101.