top of page

# Octal and Hexadecimal based number system

Updated: Aug 9

## Introduction to Number system:

Number systems is used to represent any data in digital systems. The number system has symbols called digits. The value of a digit can be found using the digit, the position or weight of the digit and the base or radix of the number system.

Radix: Radix or base of a number system is used to identify the total number of digits available in the number system. The number of digits in the number system are (r-1) where r is the radix.

Based on the radix or base of the number system, there are different types of number systems digital electronics.They are

1. Binary Number System

2. Octal Number System

3. Decimal Number System

1. Binary Number System: The Radix or base of binary number system is 2. It has two digits '0' and '1'. A number system with radix 2 is known as Binary Number System. A number system used in computers is Binary. The only language computer understands is binary Number System i.e., a series of 0's and 1's.

2. Octal Number System: A Number System with base 8 is called octal number system. The number of digits used in this system are 8. They are 0,1,2,3,4,5,6,7.

3. Decimal Number System: The Radix or base of the Decimal Number System is 10, i. e., it has 10 digits from 0 to 9 (0,1,2,3,4,5,6,7,8,9).

4. Hexadecimal Number System: The Radix or base of the hexadecimal Number System is 16. It has 16 symbols or digits. They are 0 to 9 and A to F.(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).

### Octal Number System:

Octal Number System uses 8 digits so it is also known as base 8 system. The position of every digit in octal Number System is a power of 8, each position is 8 times more than the preceding position.

Three consecutive binary digits grouped together form a octal number.

``` Binary                                 Octal
000                                     0
001                                     1
010                                     2
011                                     3
100                                     4
101                                     5
110                                     6
111                                     7```

Let us study the procedure to convert Octal Number System to different base number system and vice versa.

### Conversion of Decimal Number to Octal Number:

To convert decimal integers to octal, we use a method known as successive division by 8 and to convert decimal fraction to octal we use method of successive multiplication by 8.

Method of successive division by 8:

Conversion of Decimal integers to octal Number System

1. Decimal number given is taken as dividend.

2. As the base of octal number system is 8, divide the given decimal number with 8 i.e., divisor is 8.

3. Note the remainders.

4. Divide the quotient with 8. Continue the process until the quotient is less than 8.

5. The reverse order of the remainders i.e., from bottom to gives the equivalent octal number of the given decimal number.

Method of successive multiplication by 8:

Conversion of Decimal with fractional part to octal number

1. Separate the integral and decimal parts.

2. Follow the above steps of successive division for integral part.

3. Multiply the fractional part by 8.

4. Note the integer part of the result.

5. Continue the multiplication until the number becomes zero.

6. The integers gives the equivalent fractional octal number for the given decimal fraction.

Examples:

1. Convert the following decimal numbers to octal.

i. 320 ii. 136 iii. 17.16 (320) in decimal = (500) in octal (136) in decimal = (210) in octal (17.16) in decimal = (21.121727) in octal

### Conversion of Octal Number to Decimal Number

To convert the octal number to decimal number, identify the position and weight of each digi in given octal number. Multiply each digit with 8 to the power of n where n is the weight or position of the digit.

Examples:

1. Convert the following octal numbers to decimal.

i. 304 ii. 1534

i. 304

```304 = (3 * ((8)^2))+ (0 * ((8)^1)) + (4 * ((8)^0))
= (3 * 64) + (0 *  8) + (4 * 1)
= 192 + 0 + 4
= 196
(304) in octal  = (196) in decimal```

ii. 1534

```
1534 = (1 * ((8)^3 ))+ (5 * ((8)^2)) + (3 * ((8)^1)) + (4 * ((8)^0))
= (1 * 512) + (5 * 64) + (3 * 8) + (4 * 1)
=512 + 320 + 24 +4
= 860
(1534) in octal  = (860) in decimal```

### Octal to Binary conversion:

To convert an octal number to binary, represent each digit of the octal number in binary form (use three bit representation).

Examples:

1. Convert the following octal numbers to binary.

i. 540 ii. 352.563

i. 540

```540 = (101 110 000)
= (101110000)

(540) in octal  = (101110000) in binary		```

ii. 352.563

```352.563 = (011 101 010 . 101 110 011)
= (011101010.101 110 011)

(352.563) in octal  = (011101010.101 110 011) in binary```

### Binary to Octal Conversion:

To convert a binary number to an octal number, separate the binary number by making three digits as a group starting from LSB, add zeros at MSB if needed then represent each of the grouped digits by its octal equivalent digit.

Examples:

1. Convert the following binary numbers to octal.

i. 1010111100 ii. 01101

i. 1010111100

```1010111100 = (001 010 111 100)
= (1274)

(1010111100) in binary = (1274) in octal				```

ii. 01101

```  01101 = ( 001 101 )
= (15)

(01101 ) in binary = (15) in octal	```

To convert Octal number to hexadecimal Number, first, convert the given octal number to binary using the octal to Binary conversion technique and then group four digits of binary together starting from LSB and represent it with its hexadecimal decimal equivalent.

Examples:

1. Convert the following octal numbers to hexadecimal.

i. 56 ii. 567

i. 56

```56 = (101 110)
= (0010 1110)
= (2)(14)
= (2E)

(56) in octal  = (860) in hexadecimal			```

ii. 567

```567 = (101 110 111)
= (0001 0111 0111)
= (1)(7)(7)
= (177)

(567) in octal  = (177) in hexadecimal```

To convert hexadecimal number to octal number, convert the hexadecimal number to binary and then convert the binary number to octal number.

Examples:

1. Convert the following hexadecimal numbers to octal.

i. 951 ii. FC3A

i. 951

```951 = (1001 0101 0001)
= (100 101 010 001)
= (4 5 2 1)

(951) in Hexadecimal = (4521) in octal```

ii. FC3A

```
FC3A = (1111 1100 0011 1010)
= (001 111 110 000 111 010)
= (176072 )

(FC3A) in Hexadecimal = (176072) in octal```

Hexadecimal Number System uses 16 digits. It is represented as hex in shorthand notation. The position of every digit in the hexadecimal number system is a power of 16, i.e., each position is 16 times more than the preceding position.

Four consecutive binary digits are grouped together to make a hexadecimal number.

```  Binary                                 Hexadecimal
0000                                     0
0001                                     1
0010                                     2
0011                                     3
0100                                     4
0101                                     5
0110                                     6
0111                                     7
1000                                     8
1001                                     9
1010                                     A
1011                                     B
1100                                     C
1101                                     D
1110                                     E
1111                                     F```

Let us study the procedure to convert different base number systems to hexadecimal.

To convert a binary number to a hexadecimal number, separate the binary number by making four digits as a group starting from LSB, add zeros at MSB if needed then represent each of the grouped digits by its hexadecimal equivalent digit.

Examples:

1. Convert the following Binary numbers to hexadecimal.

i. 11010111101001 ii. 00110101101

i. 11010111101001

```11010111101001 = (0011 0101 1110 1001)
= (3 5 E 9)	```

ii. 00110101101

```00110101101 = (0001 1010 1101 )
= (1 A D )```

Conversion of Decimal integers to hexadecimal Number System

1. The decimal number given is taken as a dividend.

2. As the base of the hexadecimal number system is 16, divide the given decimal number with 16 i.e., the divisor is 16.

3. Note the remainders (use hexadecimal representation).

4. Divide the quotient by 16. Continue the process until the quotient is less than 16.

5. The reverse order of the remainders i.e., from bottom to gives the equivalent octal number of the given decimal number.

Conversion of Decimal with fraction part to hexadecimal number

1. Separate the integral and decimal parts.

2. Follow the above steps of successive division for an integral part.

3. Multiply the fractional part by 16.

4. Note the integer part of the result.

5. Continue the multiplication until the number becomes zero.

6. The integers give the equivalent fractional octal number for the given decimal fraction.

Examples:

1. Convert the following decimal numbers to hexadecimal.

i. 2540 ii. 4150 iii. 23.45

i. 2540 ii. 4150 (4150) in decimal = (1036) in hexadecimal (2540) in decimal = (9EC) in hexadecimal

iii. 2316.45 (2516.45) in decimal = (90C.733) in hexadecimal

To convert Octal number to hexadecimal Number, first, convert the given octal number to binary using the octal to Binary conversion technique and then group four digits of binary together starting from LSB and represent it with its hexadecimal decimal equivalent.

1. Convert the following octal numbers to hexadecimal.

i. 41 ii. 76

i. 41

```41 = (100 001)
= (0010 0001)
= (2)(1)
= (21)

(41) in octal = (21) in hexadecimal			```

ii. 76

```76 = (111 110)
= (0011 1110)
= (3)(E)
= (3E)

(76) in octal = (3E) in hexadecimal```

Author -

Written By: Nagapuri Swathi