# Binary System - Converting from Binary to Decimal, Binary to Hexadecimal, Hexadecimal to Binary

A Binary number is represented by 0's and 1's. The binary number is be converted into possible other three number system that are

• Binary to Decimal
• Binary to Octal
Here, all the conversions are explained with simple examples.

## Binary to Decimal

For converting a binary number into a decimal number, we are using the following steps that are:

Step 1

Start from the least significant bit. Multiply each bit of binary number with the corresponding positional base value. The base value of binary numbers is 2.

Step 2

Step 3

Finally, get the total value that is the resulting decimal value.

```	For example:
To covert the binary number(1011)2 into decimal number.

Step 1:
Start at the least significant bit. Write the positional value for each digit.
(1011)2. Positional base value for 1st position from the right is 20.
Positional base value for 2nd position from the right is 21.
Positional base value for 3rd position from the right is 22.
Positional base value for 4th position from the right is 23.

Let us multiply positional base value with the corresponding binary digit
(1011)2====> 1 * 23 + 0 * 22 + 1 * 21 + 1 * 20

Step 2:
When you Multiply each binary bit with its positional value, you get the result as follows:
(1011)2====> 1 * 8 + 0 * 4 + 1 * 2 + 1 * 1

Step 3:
(1011)2====> 8 + 0 + 2 + 1 = 11

The decimal value of the binary number (1011)2 is (11)10.
```

## Binary to fractional decimal number

If the number is a fractional part of the binary number, that is converted into a fractional part of the decimal number.

Step 1:

Start after the fractional point. Multiply each binary digits with the corresponding positional value.

Step 2:

Add all the product for getting fractional decimal value.

```	For example
To convert binary(0.1010)2 into decimal

Step 1:
Multiply each binary digits with the corresponding positional value.

Positional base value of the 1st digit after decimal point is 2-1
Positional base value of the 2nd digit after decimal point is 2-2
Positional base value of the 3rd digit after decimal point is 2-3
Positional base value of the 4th digit after decimal point is 2-4

3(0.1010)2====> 1 * 2-1 + 0 * 2-2 + 1 * 2-3 + 0 * 2-4

(0.1010)2====> 1 * 1/21 + 0 * 1/22 + 1 * 1/23 + 0 * 1/24

Step 2:
Add all the product for getting fractional decimal value.

(0.1010)2====> 0.5 + 0 + 0.125 + 0 = (0.625)10

The decimal value for the binary number(0.1010)2 is (0.625)10
```

## Binary to Octal number

A group of 3 bits of binary digits is equal to one digit octal digit. The following steps are used for binary to octal conversion.

Step 1:

Divide the binary number into a group of 3 bits on both sides of the binary point. If any group does not have 1 or 2 bits, we need to add the required number of zeros on the end of both sides of the binary point.

Step 2:

Next, write the corresponding octal value for each group of the binary number

```	For example:
To convert Binary number(10111)2 into Octal.

Step 1:
Break the whole binary into group of three bits
(10111)2======> 10 111
Add one zero on the left
(010) (111)

Step 2:
Write the corresponding octal value
111 =7,  010 =2

(010) (111) ====> 2 7

(10111)2=(27)8

The equivalent octal value for the binary(10111)2 is (27)8
```

Binary to Hexadecimal number conversion is simple and similar to octal conversion. A group of 4 binary bits is equal to 1 hexadecimal digit.

Step 1:

Divide the binary number into a group of 4 bits on both sides of the binary point. If any group does not have 1 or 2 or 3 bits, we need to add the required number of 0s on the end of both sides of the binary point.

Step 2:

Next, write the corresponding hexadecimal value for each group.

```For example:
1. To convert Binary number(1010111)2 into hexadecimal.

Step 1:
Divide it into a group that has four bits
(1010111)2======> 101 0111

Add one zero on the left to make a group
(0101) (0111)

Step 2:
Write the corresponding hexadecimal value for each group
for 0101 =5, and 0111 =7

(0101) (0111)====> 5 7

(1010111)2=(57)16

The equivalent hexadecimal value for the binary(1010111)2 is (57)16

2. To convert Binary number(1110101.001)2 into hexadecimal.

Step 1:
Divide it into a group that has 4 bits
(1110101.001)2======> 111 0101 . 001

Add one zero on both sides of the binary point to make a group
(0111) (0101).(0010)

Step 2:
Write the corresponding hexadecimal value for each group
for 0111 = 7, 0101 = 5, and 0010 = 2

(0111) (0101).(0010)===> 7 5 .2

(1110101.001)2 = (75.2)16

The equivalent hexadecimal value for the binary(1010111)2 is (57)16
```

# Binary System - Converting from Binary to Decimal, Binary to Hexadecimal, Hexadecimal to Binary

A Binary number is represented by 0's and 1's. The binary number is be converted into possible other three number system that are

• Binary to Decimal
• Binary to Octal
Here, all the conversions are explained with simple examples.

## Binary to Decimal

For converting a binary number into a decimal number, we are using the following steps that are:

Step 1

Start from the least significant bit. Multiply each bit of binary number with the corresponding positional base value. The base value of binary numbers is 2.

Step 2

Step 3

Finally, get the total value that is the resulting decimal value.

```	For example:
To covert the binary number(1011)2 into decimal number.

Step 1:
Start at the least significant bit. Write the positional value for each digit.
(1011)2. Positional base value for 1st position from the right is 20.
Positional base value for 2nd position from the right is 21.
Positional base value for 3rd position from the right is 22.
Positional base value for 4th position from the right is 23.

Let us multiply positional base value with the corresponding binary digit
(1011)2====> 1 * 23 + 0 * 22 + 1 * 21 + 1 * 20

Step 2:
When you Multiply each binary bit with its positional value, you get the result as follows:
(1011)2====> 1 * 8 + 0 * 4 + 1 * 2 + 1 * 1

Step 3:
(1011)2====> 8 + 0 + 2 + 1 = 11

The decimal value of the binary number (1011)2 is (11)10.
```

## Binary to fractional decimal number

If the number is a fractional part of the binary number, that is converted into a fractional part of the decimal number.

Step 1:

Start after the fractional point. Multiply each binary digits with the corresponding positional value.

Step 2:

Add all the product for getting fractional decimal value.

```	For example
To convert binary(0.1010)2 into decimal

Step 1:
Multiply each binary digits with the corresponding positional value.

Positional base value of the 1st digit after decimal point is 2-1
Positional base value of the 2nd digit after decimal point is 2-2
Positional base value of the 3rd digit after decimal point is 2-3
Positional base value of the 4th digit after decimal point is 2-4

3(0.1010)2====> 1 * 2-1 + 0 * 2-2 + 1 * 2-3 + 0 * 2-4

(0.1010)2====> 1 * 1/21 + 0 * 1/22 + 1 * 1/23 + 0 * 1/24

Step 2:
Add all the product for getting fractional decimal value.

(0.1010)2====> 0.5 + 0 + 0.125 + 0 = (0.625)10

The decimal value for the binary number(0.1010)2 is (0.625)10
```

## Binary to Octal number

A group of 3 bits of binary digits is equal to one digit octal digit. The following steps are used for binary to octal conversion.

Step 1:

Divide the binary number into a group of 3 bits on both sides of the binary point. If any group does not have 1 or 2 bits, we need to add the required number of zeros on the end of both sides of the binary point.

Step 2:

Next, write the corresponding octal value for each group of the binary number

```	For example:
To convert Binary number(10111)2 into Octal.

Step 1:
Break the whole binary into group of three bits
(10111)2======> 10 111
Add one zero on the left
(010) (111)

Step 2:
Write the corresponding octal value
111 =7,  010 =2

(010) (111) ====> 2 7

(10111)2=(27)8

The equivalent octal value for the binary(10111)2 is (27)8
```

Binary to Hexadecimal number conversion is simple and similar to octal conversion. A group of 4 binary bits is equal to 1 hexadecimal digit.

Step 1:

Divide the binary number into a group of 4 bits on both sides of the binary point. If any group does not have 1 or 2 or 3 bits, we need to add the required number of 0s on the end of both sides of the binary point.

Step 2:

Next, write the corresponding hexadecimal value for each group.

```For example:
1. To convert Binary number(1010111)2 into hexadecimal.

Step 1:
Divide it into a group that has four bits
(1010111)2======> 101 0111

Add one zero on the left to make a group
(0101) (0111)

Step 2:
Write the corresponding hexadecimal value for each group
for 0101 =5, and 0111 =7

(0101) (0111)====> 5 7

(1010111)2=(57)16

The equivalent hexadecimal value for the binary(1010111)2 is (57)16

2. To convert Binary number(1110101.001)2 into hexadecimal.

Step 1:
Divide it into a group that has 4 bits
(1110101.001)2======> 111 0101 . 001

Add one zero on both sides of the binary point to make a group
(0111) (0101).(0010)

Step 2:
Write the corresponding hexadecimal value for each group
for 0111 = 7, 0101 = 5, and 0010 = 2

(0111) (0101).(0010)===> 7 5 .2

(1110101.001)2 = (75.2)16

The equivalent hexadecimal value for the binary(1010111)2 is (57)16
```