Number System and their Conversions

In a computer system architecture, computer number systems are how we represent numbers.
Generally, there are two types of Number systems: the Positional & Non-positional Number systems.

What is positional number system?

Each symbol in a positional number system represents a different value. There is a fixed position for every digit of a number. A positional number’s total value is the sum of the resulting values of all positions.

For example > 12 can be written as 1 x 10 + 2 x 1, 10 + 2 = 12.

What is non- positional number system?

In a non-positional number system, each symbol, regardless of its position, represents the same value. There is no fixed position for every digit of a number. Hence, they can be kept anywhere in the number & the value will remain the same.

For example > in the Roman numeral system, I denotes one, II denotes two, and so on.

Types of positional number system

  • Binary number system: The only digits in a Binary number are 0 and 1. In this number system, each number (value) is represented by 0 and 1. Since it only has two digits, the binary number system’s base is 2. e.g. (10010)2
  • Octal number system: Eight (8) digits from 0 to 7 are used in the octal number system. In this number system, each number (value) is represented by 0,1,2,3,4,5,6, and 7. Since it only has 8 digits, the octal number system’s base is 8. e.g. (32)8
  • Decimal number system: There are ten (10) digits in the decimal number system, ranging from 0 to 9. In this number system, each number (value) is represented by 0,1,2,3,4,5,6, 7,8, and 9. Since it only has 10 digits, the decimal number system’s base is 10. e.g. (192)10
  • Hexadecimal (hex) number system: There are sixteen (16) alphanumeric values in the Hexadecimal number system, ranging from 0 to 9 and A to F. Since it has 16 alphanumeric numbers, the hexadecimal number system’s base is 16. e.g. (C50)16

Comparison of Decimal, Binary, Octal & Hexadecimal Number system.

Decimal Binary Octal Hexadecimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14

Number system Conversion

The need for number system conversion is very crucial in Computers or any digital devices. Different types of number systems can be used in electronic and digital systems (e.g. Decimal, Hexadecimal, Octal, Binary).

The number system, as we all know, is a way of communicating numbers. In number system conversion, we’ll look at how to change a number from one base to another.

Binary to Decimal Number System

The decimal number is equal to the sum of all binary digits (say, bn) times their power of 2 (2n). For the integer part, the positions are from right to left are as 20, 21, 22, 23… and so on. whereas, for fractional part, positions are from left to right are as 2-1, 2-2, 2-3, 2-4… and so on for the fractional part.

Example 1 : Convert (11001010)2 into Decimal Number System

= (11001010)2
= 1x27+1x26+0x25+0x24+1x23+0x22+1x21+0x20
= 128+64+0+0+8+0+2+0
= (202)10

Example 2 : Convert (1010.01)2 into Decimal Number System

= (1010.01)2
= 1×23 + 0x22 + 1×21+ 0x20 + 0x2 -1 + 1×2 -2
= 8+0+2+0+0+0.25
= (10.25)10 

Decimal to Binary Number system

By repeatedly dividing a number by 2 and recording the remainder from LSB to MSG, decimal numbers can be converted to binary.

For the fractional part, we multiply this number by 2, and from the result, we store the value of the integer part only, in a sequence. And the process can be repeated until the number become zero or sometime we left after 2/3 steps.

Example 1 : Convert (43)10 into Binary Number system

Decimal to Binary Conversion

Example 2 : Convert (10.25)10 into Binary Number system

Decimal to Binary Conversion

Binary to Octal Number System

Since the octal number system has only eight digits (from 0 to 7), we can represent any digit using only three bits, as in the example below.

Example 1 : Convert (1010111100)2 into octal number

Binary to Octal Number System

Diving binary digits into groups of three & converting each group of three in binary digit, we get

= (1010111100)2
= (001 010 111 100)2
= (1 2 7 4)8
= (1274)8

Example 2 : Convert binary number 0110 011.1011 into octal number.

Binary Point

Diving binary digits into groups of three & converting each group of three into the binary digits. Starting from Right for the integer part and starting from left for the fraction part.

= (0110 011.1011)2
Grouping above binary number in 3-bit basis we get,
= (0 110 011 . 101  1)2
= (110 011 . 101 100)2
Writing the equivalent Octal number we get,
= (6 3 . 5 4)8
= (63.54)8

Octal to Binary Number System

This conversion is just an opposite of Binary to Octal Conversion. In this, converting each octal number into binary in three-bit-basis and then combining all binary digits into one.

This can be much clear with the following example:

Example 1 : Convert (120)8 into a binary number.

Writing the equivalent Binary number in 3-bit basis we get,
1208 = (001 010 000)2
Since zeros on the left can be ignored. Thus,
1208 = (1010000)2 

Example 2 : Convert (352.563)8 into binary number.

= (352.563)8 
Writing the equivalent Binary number in 3-bit basis we get,
= (011 101 010 . 101 110 011)2 
= (011101010.101110011)2

Binary to Hexadecimal Number System

We can represent any digit of the hexadecimal number system using only 4-bit binary numbers. Hence, each group of 4-bit binary numbers is replaced with its corresponding hexadecimal digits. The conversion process is similar to the Octal Number system as described above.

Example 1 : Convert (1010101101001 )2 into hexadecimal number.

= (1010101101001)2
Grouping above binary number in 4-bit basis we get,
= (1   0101   0110   1001)2
= (0001 0101 0110 1001)2
Writing the equivalent Hexadecimal number we get,
= (1   5   6   9)16
= (1569)16

Example 2 : Convert (001100101.110111)2 into hexadecimal number.

Hexadecimal Number
= (001100101.110111)2
= (0  0110  0101 . 1101  1100)2
= (0110  0101 . 1101  1100)2
= (6 5 . D C)16
= (65.DC)16

Hexadecimal to Binary Number System

Hexadecimal number can be converted to a binary number by converting each hexadecimal digit to its 4-bit equivalent binary bits.

 Example 1 : Convert (BCA)16 into a binary number.

Writing the equivalent Binary number in a 3-bit basis we get,
(BCA)16 = (1011   1100   1010)2
Now combining all bits together we get the final answer
(BCA)16  = (101111001010)2

Example 2 : Convert (35.1A)16 into binary number.

= (35.1A)16
Writing the equivalent Binary number in 4-bit basis we get,
= (0011   0101  . 0001   1010)2 
= (00110101.00011010)2  

Octal to Decimal Number System

The conversion can be done by showing each digit multiplied with 8 as an increasing power as shown in the example below: (This process is similar to Binary > Decimal conversion)

Example 1 : Convert (345)8 into Decimal Number system.

(345)8
= (3 * 82) + (4 * 81) + (5 * 80) 
= (3 * 64) + (4 * 8) + (5 * 1)
= (229)10

Example 2 : Convert (15.10)8 into Decimal Number system.

(15.10)8
= (1 * 81) + (5 * 80) + (1 * 8-1) + (0 * 8-2)
= 8 + 5 + 0.125 + 0
= (13.125)10

Decimal to Octal Number System

This conversion can be done by performing short division by 8 with remainder (Similar as in Decimal to Binary Conversion).

Example 1 : Convert (100)10 into Octal Number system.

Decimal to Octal Number System

Example 2 : Convert (0.342)10 into Octal Number system.

Octal to Decimal

Octal to Hexadecimal Number System

The binary method can be used to convert an octal number to a hexadecimal number and vice versa. There is no direct conversion method to convert Octal to Hexadecimal. Hence, we will first convert Octal to Binary & then Binary to Hexadecimal.

Example 1 : Convert (456)8 into Hexadecimal Number system.

Hexadecimal to Octal Number System

Here, we will first convert Hexadecimal to Binary & then Binary to Octal number system.

Example 1 : Convert (4DF)16 into Octal Number system.

Decimal to Hexadecimal Number System

Example 1 : Convert (2545)10 into Hexadecimal Number system.

Example 2 : Convert (0.342)10 into Hexadecimal Number system.

Therefore (0.342)10 = (0.578)16

Hexadecimal to Decimal Number System

 Example 1 : Convert (ABC)16 into decimal number.

Since, A = 10, B = 11 & C = 12. The equivalent decimal number is calculated below:

= (ABC)16
= (10x162+11x161+12x160)10
= (256 + 176 + 12)10
= (444)10

 Example 2 : Convert (1F.01B)16 into decimal number.

Since, B = 11 & F = 15. Hence, equivalent decimal number is calculated below:

= (1F.01B)16
= (1x161+15x160 +0x16-1+1x16-2+11x16-3)10
= (31.0065918)10 which is answer.
Print Friendly, PDF & Email
by Rajesh Bhatt
Rajesh is an IT Lecturer with a keen interest in Technological Research over the world. He is equally passionate about Gadgets, Music & Travelling.

2 thoughts on “Number System and their Conversions”

Leave a Comment

Hey, wait!Get Regular Update's

Subscribe Stay Connected, Keep Learning!