• Courses
• Data Structure
• ### Number Base Conversion (Binary | Octal | Decimal | Hexadecimal) All in One

Posted on 2021-03-07

Number conversion is the process of converting one number base to another base. In computer science, we have to study about 4 types of number systems, binary, octal, decimal, and hexadecimal number. When we convert one number system to another number system, it will be a total of 12 different number conversion types, which are illustrated below. While converting one number base to another number base it will be better to use the following table.

1. Binary to Decimal
2. Octal to Decimal
4. Decimal to Binary
5. Octal to Binary
7. Binary to Octal
8. Decimal to Octal

1) Binary to Decimal Conversion

i) Convert 11100011101

Convert 11010112 = into equivalent decimal number

Method 1:

```11010112
= 1×26+1×25+0×24+1×23+0×22+1×21+1×20
= 64+32+0+8+0+2+1
= 10710
```

Method 2:

11010112

 Place Value 64 32 16 8 4 2 1 Binary 1 1 0 1 0 1 1 Decimal 64 + 32 + 8 + 2 + 1 = 10710

ii) Convert 1111001101112 into an equivalent decimal number

Method 1:

```1111001101112
= 1×211+1×210+1×29+1×28+0×27+0×26+1×25+1×24+0×23+1×22+1×21+1×20
= 2048+1024+512+265+0+0+32+16+0+4+2+1
= 3895
```

Method 2:

 Place Value 2048 1024 512 256 128 64 32 16 8 4 2 1 Binary 1 1 1 1 0 0 1 1 0 1 1 1 Decimal 2048+1024+512+265+0+0+32+16+0+4+2+1 = 3895

2) Octal to Decimal Conversion

i) Convert 125638 to a decimal equivalent number

```= 1×84+ 2×83+5×82+6×81+3×80
= 4096 + 1024 + 320 + 48 + 3
= 549110
```

Convert 7A2BD16  into decimal equivalent number

A=10, B=11, C=12, D=13, E=14, F=15

``` = 7×164+10×163+2×162+11×161+13×160
= 458,752 + 40,960+512+176+13
= 50041310
```

4) Decimal to Binary Conversion

Convert 56310 into binary equivalent

Method 1:

 2 563 -----1 -----1 -----0 -----0 -----1 -----1 -----0 -----0 -----0 2 281 2 140 2 70 2 35 2 17 2 8 2 4 2 2 1

So, 56310 = 10001100112
Note: (Write binary numbers from bottom to up)

5) Octal to Binary Conversion

Convert 27638 into an equivalent binary number

Octal Number: 2763

3 group binary digits

 2 7 6 3 010 111 110 011

:: 27638 = 0101111100112

Convert AD710  into an equivalent binary number

4 group binary digit

 A D 7 1010 1101 0111

7) Binary to Octal Conversion

Convert 111000101102 into equivalent octal number

3 group binary digits  (Note: group the binary digits from right to left)

 011 100 010 110 3 4 2 6

:: 111000101102 = 3468

8)  Decimal to Octal Conversion

Convert 8965210 into equivalent octal number

 8 89652 -----4 -----6 -----0 -----7 -----5 8 11206 8 1400 8 175 8 21 2

:: 8965210 = 25706410

The process of converting a hexadecimal number into an octal number is that, at first, we convert a hexadecimal number into binary and after that, we convert the obtained binary number into an octal number.

Convert A9D516 into equivalent octal number

Step 1: Converting Hexadecimal number into a binary number

4 group binary digits

 A 9 D 5 1010 1001 1101 0101
```:: A9D516 = 10101001110101012
Step 2: Now converting binary to octal number
3 group binary digits
001  010  100  111  010  101
1    2    4    7    2    5

So,  A9D516 = 1247258
```

Convert 101110100100012 into equivalent hexadecimal number

``` 4 group binary digits
0010   1110   1001   0001
2       E     9      1

:: 101110100100012  =2E9116```

The process to convert an octal number into hexadecimal first, we will convert an octal number into binary numbers system and after that again we convert the obtained binary number into hexadecimal number by making group of 4 binary digits.

```E.g.    Convert 1247258 into hexadecimal number
Step 1: Converting octal to binary
```
 1 2 4 7 2 5 001 010 100 111 010 101

:: 1247258 = 0010101001110101012

``` Step 2: Now converting obtained binary number to octal
Binary = 0010101001110101012

Making 4 group binary digits from right
0000   1010   1001   1101   0101
0       A     9       D     5

:: 0010101001110101012 = A9D516
So, 1247258 = A9D516
```

Convert 968510 to equivalent hexadecimal number

 16 9685 -----5 -----13 -----5 16 605 16 37 2

:: 968510 = 25D516

1825

#### Recent Guides

 Secondary Level Teaching License Examination Sample question paper Secondary Level General Examination Sample question paper-2078 English, Lower Secondary Level Sample question paper-2078 English, Secondary Level Sample Question Paper-2078