Number System and conversions

Number System

·       A method of showing numbers.

·       A mathematical way for representing the numbers set or symbols.

·       Show à how data are represented before the processed by any digital system.

Example: - counting things, date, time, money, etc.

·       Used for measurement and labelling.  

-----------------------------------------------------------------------

Concept of Bit and Byte

1. Bit (Binary Digit):

  • Represented as a single digit in the binary numeral system.
  • Most basic unit of information in computing.
  • Only two possible values: 0 or 1. (on/off, true/false, yes/no, etc.).
  • Used in computers for low-level data manipulation,
  • Performing operations in hardware circuits and encoding information in memory.

·       Used in networking, where data transmission speeds are measured in bits per second (bps).

·       Involved in logical operations at the hardware level (e.g., AND, OR, NOT).

·       Used for flags or binary states in programming, such as true or false.

 

2. Byte:

  • a group of 8 bits.
  • basic unit of storageà represent a wide range of values.
  • Represent a character (such as a letter or number) in text encoding systems like ASCII or UTF-8.

·       Standard measure for computer memory (RAM size is typically measured in MB or GB, which are multiples of bytes).

·       Represent a character in text files.

·       Storage space in hard drives, USB drives, etc., is usually measured in bytes and larger units like kilobytes (KB), megabytes (MB), gigabytes (GB), etc.

·       In image files or audio files, bytes represent the data for pixels or sound samples.

 

 

Relation Between Bit and Byte:

  • 1 Byte = 8 Bits
  • Kilobyte (KB): 1 KB = 1,024 bytes
  • Megabyte (MB): 1 MB = 1,024 KB = 1,048,576 bytes
  • Gigabyte (GB): 1 GB = 1,024 MB = 1,073,741,824 bytes
  • Terabyte (TB): 1 TB = 1,024 GB = 1,099,511,627,776 bytes

 

Example:

  • Bit Example: A simple binary number like 1010 is a 4-bit number.
  • Byte Example: The word "Hello" in ASCII encoding is represented by 5 bytes:
    H = 01001000
    e = 01100101
    l = 01101100
    l = 01101100
    o = 01101111

--------------------------------------------------------------------------------------------------

Types of Number Systems

Based on the base value and the number.

The four common types of Number System are:

  • Decimal Number System
  • Binary Number System
  • Octal Number System
  • Hexadecimal Number System

 

Decimal Number System 

Base value 10.

Uses 10 digits i.e. 0-9 etc.

 

Decimal Number System

 

Binary Number System 

Base value 2.

Uses 2 digits i.e. 0 and 1.

Very useful in electronic devices and computer systems à using two states ON and OFF.

 

Example of 19 in the binary system:-

Here 19 Or (19)10 can be written as (10011)2

 

Octal Number System 

o   Base value is 8.

o   Uses 8 digits i.e. 0-7.

 

Example:-

(135)10 can be written as (207)8

Hexadecimal Number System 

base value 16.

uses 16 digitsà 0-9 and A-F (10à A, 11à B, 12àC, 13àD, 14àE, and 15àF).

useful for handling memory address locations.

Hexadecimal

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

Decimal

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

 

 

 Examples,

(255)10  can be written as (FF)16

 

Importance of Number Systems in Computer Science

  • Memory Management: 

Use binary systems for memory management.

 

  • Programming: 

Use hexadecimalà represent memory addresses and binary-coded values.

Octal and binary representations of bitwise operations.

 

  • Data Transmission: 

Use Binary

 

o   

  • Digital Electronics: 

Use binary à circuits that are based on binary signals.

 

  • Representation of Colours: 

In graphics and web developmentà use, hexadecimal is frequently usedà represent colorations.

Each coloration element (RGB)àrepresented with a resource of hexadecimal digits.

  

Advantages and Disadvantages of Number Systems

1) Binary System

  • Advantages: Direct use in digital logic and electronic devices.
  • Disadvantages: Lengthy illustration for massive numbers, limited expressiveness in decimal fractions.

2) Octal System

  • Advantages: easy readability.
  • Disadvantages: Less commonly used.

3) Decimal System

  • Advantages: Easily under stable, modern for vast arithmetic.
  • Disadvantages: Inadequate for binary data, constrained expressiveness for non-decimal fractions.

4) Hexadecimal System

  • Advantages: Compact representation of binary, widely used in programming.
  • Disadvantages: Unapproachable for beginners.

 ----------------------------------------------------------------------------------------------------

Conversion of Number Systems

Conversion between numbers of systems.

From one number system to another:

  • Decimal to Other Number Systems
  • Binary to Other Number Systems
  • Octal to Other Number Systems
  • Hexadecimal to Other Number Systems

 

Number System Conversion Methods

·       A number N in base or radix b can be written as: 

(N)b = dn-1 dn-2 -- -- -- -- d1 d0 . d-1 d-2 -- -- -- -- d-m

 

dn-1 to d0 is the integer part, follows a radix point, and then d-1 to d-m is the fractional part. 

dn-1 = Most significant bit (MSB) 
d-m = Least significant bit (LSB)
 

    I.         Conversion from Decimal to Other Number Systems

Decimal Numbers are represented with digits 0-9 and with base 10. Conversion of a number system means conversion from one base to another. Following are the conversion of the Decimal Number System to other Number Systems:

1.    Decimal to Binary Conversion

Decimal numbers are represented in base 10, but the binary numbers are of base 2.

Hence, to convert a decimal number to binary number, the base of that number is to be changed.

Follow the steps given below:

Step 1: Divide the Decimal Number with the base of the number system to be converted to. Here the conversion is to binary, hence the divisor will be 2.

Step 2: The remainder obtained from the division will become the least significant digit of the new number.

Step 3: The quotient obtained from the division will become the next dividend and will be divided by base i.e. 2.

Step 4: The remainder obtained will become the second least significant digit i.e. it will be added in the left of the previously obtained digit.

 

Example

(10.25)10 

 

 

Note: Keep multiplying the fractional part with 2 until decimal part 0.00 is obtained. 
(0.25)10 = (0.01)2 

Answer: (10.25)10 = (1010.01)2  

 

2.    Decimal to Octal Conversion

Octal Numbers are represented in base 8.

To convert a decimal number to octal number, the base of that number is to be changed.

Follow the steps given below:

Step 1: Divide the Decimal Number with the base of the number system to be converted to. Here the conversion is to octal, hence the divisor will be 8.

Step 2: The remainder obtained from the division will become the least significant digit of the new number.

Step 3: The quotient obtained from the division will become the next dividend and will be divided by base i.e. 8.

Step 4: The remainder obtained will become the second least significant digit i.e. it will be added in the left of the previously obtained digit.

Now, the steps 3 and 4 are repeated until the quotient obtained becomes 0, and the remainders obtained after each iteration are added to the left of the existing digits.

writing down from bottom to top, And the number contains fractional part, then multiply 8 in the fractional part.

Example

(10.25)10 
(10)10 = (12)8 
Fractional part: 
0.25 x 8 = 2.00 

Note: Keep multiplying the fractional part by 8 until the decimal part .00 is obtained. 
(.25)10 = (.2)8

Answer: (10.25)10 = (12.2)8 

 

3.     Decimal to Hexadecimal Conversion

Hexadecimal Numbers are represented in base 16. Hence, to convert a decimal number to a hexadecimal number, the base of that number is to be changed.

The decimal numeral system has a base value of 10 (0 to 9) and the hexadecimal has a base value of 16 (0 to 9 and A to F for 10-15). 

Follow the steps given below:

Step 1: Divide the decimal number by the base of the number system to be converted to. Here the conversion is to Hex, hence the divisor will be 16.

Step 2: The remainder obtained from the division will become the least significant digit of the new number.

Step 3: The quotient obtained from the division will become the next dividend and will be divided by base i.e. 16.

Step 4: The remainder obtained will become the second least significant digit i.e. it will be added in the left of the previously obtained digit.

Now, steps 3 and 4 are repeated until the quotient obtained becomes 0, and the remainders obtained after each iteration are added to the left of the existing digits.

 

There are different ways to convert Decimal to hexadecimal numbers. They are:

Converting Numbers with the Integer Part

Step 1: Take the decimal number as the dividend and 16 as the divisor (hexadecimal number will have 16 as a base)

Step 2: Divide the dividend by the divisor and store the remainder in an array

Step 3: Now divide the quotient obtained from the above step by 16 and store the remainder in the array.

Step 4: Repeat the third step until the number is greater than zero.

Step 5: The final hexadecimal value will be the reverse order of the array.

 

Example 1: the decimal number 450. convert this decimal number to a hexadecimal number.

Solution:

Given: Decimal number = 450(10)

Step 1: 450/16 gives Q1 = 28 and R1 = 2

Step 2: 28/16 gives Q2 = 1 and R2 = 12 = C

Step 3: 1/16 gives Q3 =  0 and R3 = 1

Step 4: 0/16 gives Q4 =  0 and R4 = 0

Therefore, the hexadecimal value is 01C2(16)

 

Converting Numbers with Fractional Parts

Step 1: Take the decimal fractional number and multiply it with 16 (hexadecimal number will have 16 as a base)

Step 2: Store the remainder in an array i.e. the integer part

Step 3: Repeat the above two steps until the number is zero.

Step 4: The final hexadecimal value will be the elements of the array.

 

Example 1: Convert 0.0645(10) to _______(16)  

Solution: 

Given: Decimal number = 0.0645(10)

Step 1: 0.0645 x 16 = 1.032 and R1 = 1

Step 2: 0.032 x 16 = 0.512 and R2 = 0  

Step 3: 0.512 x 16 = 8.192 and R3 = 8

Step 4: 0.192 x 16 = 3.072 and R3 = 3

Step 5: 0.072 x 16 = 1.152 and R3 = 1

The fractional part is still not zero so it continues, now we can take up to 5 remainders

Therefore, the hexadecimal value is 0.10831…(16)

 

 

Converting Numbers with Both Integer and Fractional parts

Steps of both the integer part and the fractional part are to be followed.

Example 1: Convert 256.00390625(10) to _________(16)  

Solution:

 Given: Decimal number = 256.00390625(10) 

Let’s perform the conversion on the integer part:

Integer value = 256(10)

Step 1: 256/16 gives Q1 = 16 and R1 = 0

Step 2: 16/16 gives Q2 = 1 and R2 = 0

Step 3: 1/16 gives Q3 =  0 and R3 = 1

Let’s perform the conversion on the fractional part:

Fractional value = 0.00390625(10)

Step 1: 0.00390625 x 16 = 0.0625 and R1 = 0

Step 2: 0.0625 x 16 = 1.0 and R2 = 1 

Step 3: 0.0 x 16 = 0 and R3 = 0

Therefore, the hexadecimal value is 100.010(16)

--------------------------------------------------------------------------------------- 

 

    I.         Conversion from Binary to Other Number Systems

Binary Numbers are represented with digits 0 and 1 and with base 2. Conversion of a number system means conversion from one base to another. The following are the conversions of the Binary Number System to other Number Systems:

 

1.   Binary to Decimal Conversion

Binary numbers are represented in base 2, but decimal numbers are in base 10. Hence, to convert the binary number into a decimal number, the base of that number must be changed. Follow the steps given below:

Step 1: Multiply each digit of the Binary number by the place value of that digit, starting from right to left, i.e. from LSB to MSB.

Step 2: Add the result of this multiplication and the decimal number will be formed.

 

Method 1: Using Positions

Binary to Decimal Conversion can be achieved using the example added below.

Example 1: Consider a binary number 1111. Convert this binary number to a decimal number.

Converting from binary to decimal, consider each digit in the binary number from right to left.


Example 2: Convert (101010)2 = (?)10

Convert 101010 to decimal

 

Example 3: Convert (11100)2 = (?)10

Convert 11100 to Decimal

Resultant Decimal number = 0+0+4+8+16 = 28

So (11100)2 = (28)10

 

Method 2: Doubling Method

Example 1: Convert Binary number (10001)2 to decimal.

In this approach consider each digit but from left to right and performs step-wise computations on it.

1

0

0

0

1

Step-1 First we need to multiply 0 with 2 and add the 1st digit in binary number.

0 x 2 + 1 = 0 + 1 = 1

Step-2 Now use the result of above step and multiply with 2 and add the second digit of binary number.

1

0

0

0

1

1 x 2 + 0 = 2 + 0 = 2

The same step 2 is repeated until there will be no digit left. The final result will be the resultant decimal number.

1

0

0

0

1

2 x 2 + 0 = 4 + 0 = 4

1

0

0

0

1

4 x 2 + 0 = 8 + 0 = 8

1

0

0

0

1

8 x 2 + 1 = 16 + 1 = 17

So we performed step 2 on all remaining numbers and finally, we left with result 17 which is a decimal number for the given binary number.

So (10001)2 = (17)10

 

Example 2: Convert (111)2 to decimal using doubling approach.

1

1

1

0 x 2 + 1 = 0 + 1 = 1

1

1

1

1 x 2 + 1 = 2 + 1 = 3

1

1

1

3 x 2 + 1 = 6 + 1 = 7

The final result is 7 which is a Decimal number for 111 binary numeral system. So (111)2 = (7)10

 

Each digit in binary is represented using 0 and 1 and they are the powers of 2 starting from left hand side and then the power is gradually increased from 0 to (n-1).

 

Binary to Decimal Conversion Table

The given binary to decimal conversion table will help you to convert binary to decimal.

Decimal Number

Binary Number

0

0

1

1

2

10

3

11

4

100

5

101

6

110

7

111

8

1000

9

1001

10

1010

11

1011

12

1100

13

1101

14

1110

15

1111

16

10000

17

10001

18

10010

19

10011

20

10100

21

10101

22

10110

23

10111

24

11000

25

11001

26

11010

27

11011

28

11100

29

11101

30

11110

31

11111

32

100000

64

1000000

128

10000000

256

100000000

 

2.    Binary to Octal Conversion

Binary numbers are represented in base 2 but the octal numbers are of base 8.

Steps:

Step 1: Divide the binary number into groups of three digits starting from right to left i.e. from LSB to MSB.

Step 2: Convert these groups into equivalent octal digits. Add 0’s on the left to adjust the groups.

 

Example

111101101

111 101 101

(111101101)2 = (755)8

 

Binary to Decimal Then Decimal to Octal

The steps to convert binary to octal using decimal are listed below.

  • First convert binary to its decimal equivalent by multiplying the bits by its equivalent power of two.
  • Then, convert obtained decimal to octal by division by base method.

 

Example: (1111)2 = (______)8

Solution:

First convert (1111)2 into its decimal = (1111)2 = 23 × 1 + 22 × 1 + 21 × 1 + 20 × 1 = (15)10

Then, convert (15)10 decimal into octal by division by 8 method

Octal base (8)

Decimal number to be converted into octal

Remainder

8

15

7 ↑

8

1

1 ↑

8

0

0 ↑

Write remainders from bottom to top to get octal equivalent.

(15)10 = (17)8

(1111)2 = (17)8

 

Direct Method for Binary to Octal Conversion

Lightbox

  •  

Decimal

Binary

Octal

0

000

0

1

001

1

2

010

2

3

011

3

4

100

4

5

101

5

6

110

6

7

111

7

 

Example: Convert (111010. 1001)2 = (____)8

Solution:

111010. 1001

111 010

100 100

7 2

4 4

(111010. 1001)2 = (72.44)8

We added two zeros at the last as we have only 1, which does not make a group of three bits. 0s are added after 01 because it is after the radix point.

 

Example 1: Convert binary (100001)2 to octal.

Solution:

First convert binary (100001)2 to decimal

(100001)2 = 1 × 25 + 0 × 24 + 0 × 23 + 0 × 22 + 0 × 21 + 1 × 20

(100001)2 = 33

Now, convert (33)10 to octal

Octal base (8)

Decimal number to be converted into octal

Remainder

8

33

1 ↑

8

4

4 ↑

(33)10 = (41)8

(100001)2 = (41)8

 

Example 2: Convert (1011)2 = (?)8

Solution:

We will use direct method for binary to octal conversion.

= (1011)2

= 001 011

= 1 3

= (1011)2 = (13)8

 

Example 3: Convert (0010011)2 = (____)8

Solution:

(0010011)2

000 010 011

0 2 3

(0010011)2 = (23)8

--------------------------------------------------

1.   Binary to Hexadecimal Conversion

Binary numbers are represented in base 2 but the Hexadecimal numbers are of base 16.

To convert the binary number into Hexa number, the base of that number is to be changed. 

 

Follow the steps given below:

Step 1: Divide the binary number into groups of four digits starting from right to left i.e. from LSB to MSB.

Step 2: Convert these groups into equivalent hex digits.

Method 1

  1. Firstly, convert the given binary number into decimal.
  1. Then, convert the obtained decimal into hexadecimal.

 

Example: (1110)2 = (_______)16

First convert (1110)2 into decimal = (1110)2 = 23 × 1 + 22 × 1 + 21 × 1 + 20 × 0 = 8 + 4 + 2 + 0 = (14)10

Then, convert (14)10 into hexadecimal = (14)10 = (E)16

 

Example 2 : (0.11001)2 = (_________)16

First convert (0)2 to decimal = 0*20 = (0)10

Then convert (11001)2 to decimal = 1*2-1 + 1*2-2 + 0*2-3 + 0*2-4 + 1*2-5 = (0.78125)10

Now, convert (0)10 into hexadecimal   = (0)16

Now convert (.78125)10  to hexadecimal

0.78125*16 = 12.5

0.5*16 = 8.0

(.78125)10 to hexadecimal = (.C8)16

where C for 12 and 8 for 8

So  (0.11001)2 = (0.C8)16

 

Method 2: (Direct Method for converting binary to hexadecimal) 

Take the given binary number and form the collection of four bits called a quad, then replace the quad with its hexadecimal equivalent.

obtained number is the conversion of a given binary to hexadecimal.

 

Note

  • If, while forming the quad, the bits are before the radix point, then start forming the quad from the LSB bit and if the bits are after the radix point, start forming the quad from the immediate bit after the radix point.
  • While forming the quad, the number of bits is less than 4 and before the radix point, then add 0s before the fewer bits to form a quad.
  • While forming the quad, the number of bits is less than 4 and after the radix point then, add 0s after the fewer bits to form a quad.

Decimal

Binary

Hexadecimal

0

0000

0

1

0001

1

2

0010

2

3

0011

3

4

0100

4

5

0101

5

6

0110

6

7

0111

7

8

1000

8

9

1001

9

10

1010

A

 

Example: (11101111.111001)2 = (_______)16 

1110 1111.1110 01

1110 1111

1110  0100

  E      F

  E       4 

(11101111.111001)2 = (EF.E4)16

We added two zeros at the last as we have only 01, which does not make a quad. 0s are added after 01 because it is after the radix point.

 

Sample Questions

Question 1: Convert: (111111101)2 = (_________)16

Solution:

(111111101)2 = 0001 1111 1101  (The bold three 0s are added before 1 as it is integral part (before the radix point))

= 1 F D

= (111111101)2 = (1FD)16

Question 2: Convert: (01011110001)2 = (_________)16

Solution:

(01011110001)2 = 0010 1111 0001 (The bold one 0s are added before 1 as it is integral part (before the radix point))

= 2 F 1

= (01011110001)2 = (2F1)16

Question 3: Convert: (0.11001)2 = (_________)16

Solution:

(0.11001)2 = 0000 . 1100 1000  (The bold three 0s are added before 0 as it is an integral part (before the radix point), and 3 bold 0s are added after 1 as 1 is after the radix point).

= 0 C 8

(0.11001)2 = (0.C8)16

Question 4: Convert: (1.1)2 = (_______)16

Solution:

(1.1)2 = 0001 . 1000 (The bold three 0s are added before 1 as it is an integral part (before the radix point), and 3 bold 0s are added after 1 as 1 is after the radix point).

= 1 8

= (1.1)2 = (1.8)16

 

II.         Conversion from Octal to Other Number Systems

Octal Numbers are represented with digits 0-7 and with base 8.

Follow the steps given below:

Step 1: Multiply each digit of the Octal number with the place value of that digit, starting from right to left i.e. from LSB to MSB.

Step 2: Add the result of this multiplication and the decimal number will be formed.

 

1.    Octal to Decimal Conversion

convert an octal number to a decimal number, the base of that number is to be changed. Follow the steps given below:

Step 1: Multiply each digit of the Octal number with the place value of that digit, starting from right to left i.e. from LSB to MSB.

Step 2: Add the result of this multiplication and the decimal number will be formed.

 

To convert an octal number to a decimal number we need to multiply each digit of the given octal with the reducing power of 8. 

 

Examples on Octal to Decimal

Example 1: Suppose 215is an octal number, then it’s decimal form will be,

2158 = 2 × 82 + 1 × 81 + 5 × 80

          = 2 × 64+ 1 × 8 + 5 × 1 = 128 + 8 + 5

          =  14110

 

Example 2: Let 125 is an octal number denoted by 1258. Find the decimal number.

1258 = 1× 82 + 2 × 81 + 5 × 80

          = 1 × 64 + 2 × 8 + 5 × 1 = 64+16+5

          =8510

Binary To Octal Number

A binary number can be converted into an octal number, with the help of the below-given table.

 

 

Octal Number

Equivalent Binary Number

0

0

1

1

2

10

3

11

4

100

5

101

6

110

7

111

 

2.    Octal to Binary Conversion

Octal numbers are represented in base 8, but the binary numbers are of base 2.

to convert an octal number to a binary number, the base of that number is to be changed.

 

Follow the steps given below:

Step 1: Write each digit of the octal number separately.

Step 2: Convert each digit into an equivalent group of three binary digits.

Step 3: Combine these groups to form the whole binary number.

 

Step-by-Step Conversion Process

  1. Understand the Relationship
    Each octal digit corresponds to exactly 3 binary digits because 23=8.
    For example:
    • Octal 0 = Binary 000
    • Octal 1 = Binary 001
    • Octal 2 = Binary 010
    • Octal 3 = Binary 011
    • Octal 4 = Binary 100
    • Octal 5 = Binary 101
    • Octal 6 = Binary 110
    • Octal 7 = Binary 111
  2. Convert Each Octal Digit to Binary
    Replace each octal digit with its corresponding 3-bit binary representation.
  3. Combine the Binary Groups
    Concatenate all binary groups to get the final binary result.

Example

Convert Octal 345 to Binary:

  1. Write each octal digit:
    • 3 = 011
    • 4 = 100
    • 5 = 101
  2. Concatenate the binary groups:
    • 011 100 101
  3. Result:
    • Binary = 011100101

 

3. Octal to Hexadecimal Conversion

Octal numbers are represented in base 8, but the hexadecimal numbers are of base 16.

to convert an octal number to a hex number, the base of that number is to be changed.

Follow the steps given below:

Step 1: We need to convert the Octal number to Binary first. For that, follow the steps given in the above conversion.

Step 2: Now to convert the binary number to Hex number, divide the binary digits into groups of four digits starting from right to left i.e. from LSB to MSB.

Step 3: Add zeros prior to MSB to make it a proper group of four digits(if required)

Step 4: Now convert these groups into their relevant decimal values.

Step 5: For values from 10-15, convert it into Hex symbols i.e from A-F.

 

Step 1: Convert Octal to Binary

Each octal digit is converted to 3 binary digits:

  • 3 = 011
  • 4 = 100
  • 5 = 101

So, Octal 345 = Binary 011100101.

 

Step 2: Group Binary Digits into Nibbles

Group the binary digits into 4-bit groups from the right:

  • Binary: 011100101 → Add leading zeroes: 00011100101 → Grouped: 0001 1100 101.

 

Step 3: Convert Binary to Hexadecimal

Convert each 4-bit group to hexadecimal:

  • 0001 = 1
  • 1100 = C
  • 0101 = 5

So, Binary 011100101 = Hexadecimal 1C5.

-----------------------------------------------------------------------------------------

 

Conversion from Hexadecimal to Other Number Systems

Hex Numbers are represented with digits 0-9 and with letters A-F and with base 16.

 

1.    Hexadecimal to Decimal Conversion

Hexadecimal numbers are represented in base 16 but the decimal numbers are of base 10.

to convert a hexadecimal number to a decimal number, the base of that number is to be changed.

 

The steps given below:

Step 1: Write the decimal values of the symbols used in the Hex number i.e. from A-F

Step 2: Multiply each digit of the Hex number with its place value. starting from right to left i.e. LSB to MSB.

Step 3: Add the result of multiplications and the final sum will be the decimal number.

 

Convert Hexadecimal 1A3 to Decimal

  1. Write the number with positions:
    1A3= 1×162+A×161+3×160
  2.  1×162+A×161+3×160.
  3. Replace A with its decimal equivalent (10):
    1×256+10×16+3×1 .
  4. Perform the calculations:
    256+160+3=419.
  5. Result:
    Hexadecimal 1A3 = Decimal 419.

 

2.   Hexadecimal to Binary Conversion

Hexa numbers are represented in base 16, but the binary numbers are of base 2.

To convert a hexadecimal number to a binary number, the base of that number is to be changed. 

 

Follow the steps given below:

Step 1: Convert the Hex symbols into its equivalent decimal values.

Step 2: Write each digit of the Hexadecimal number separately.

Step 3: Convert each digit into an equivalent group of four binary digits.

Step 4: Combine these groups to form the whole binary number.

 

Conversion Process

  1. Understand the Relationship
    Each hexadecimal digit corresponds to exactly 4 binary digits because 24=162^4 = 1624=16.
    For example:
    • Hex 0 = Binary 0000
    • Hex 1 = Binary 0001
    • Hex 2 = Binary 0010
    • Hex 3 = Binary 0011
    • Hex 4 = Binary 0100
    • Hex 5 = Binary 0101
    • Hex 6 = Binary 0110
    • Hex 7 = Binary 0111
    • Hex 8 = Binary 1000
    • Hex 9 = Binary 1001
    • Hex A = Binary 1010
    • Hex B = Binary 1011
    • Hex C = Binary 1100
    • Hex D = Binary 1101
    • Hex E = Binary 1110
    • Hex F = Binary 1111
  2. Convert Each Hexadecimal Digit to Binary
    Replace each hex digit with its corresponding 4-bit binary value.
  3. Combine the Binary Groups
    Concatenate all the binary groups to get the final binary result.

Example: Convert Hexadecimal 1A3 to Binary

  1. Write each hexadecimal digit:
    • 1 = 0001
    • A = 1010
    • 3 = 0011
  2. Concatenate the binary groups:
    • 0001 1010 0011
  3. Result:
    • Hexadecimal 1A3 = Binary 000110100011

 

3. Hexadecimal to Octal Conversion:

Hexadecimal numbers are represented in base 16, but the octal numbers are of base 8.

To convert a hex number to an octal number, the base of that number is to be changed

 

Follow the steps given below:

Step 1: We need to convert the Hexadecimal number to Binary first. For that, follow the steps given in the above conversion.

Step 2: Now to convert the binary number to Octal number, divide the binary digits into groups of three digits starting from right to left i.e. from LSB to MSB.

Step 3: Add zeros prior to MSB to make it a proper group of three digits(if required)

Step 4: Now convert these groups into their relevant decimal values.

 

Example: Convert Hexadecimal 1A3 to Octal

Step 1: Convert Hexadecimal to Binary

Convert each hex digit to its binary equivalent:

  • 1 = 0001
  • A = 1010
  • 3 = 0011

Hexadecimal 1A3 = Binary 000110100011.

Step 2: Group Binary Digits in Sets of 3

Group the binary digits into sets of 3 from right to left:

  • Binary: 000110100011 → Grouped: 000 110 100 011.

Step 3: Convert Binary Groups to Octal

Convert each group of 3 binary digits to its octal equivalent:

  • 000 = 0
  • 110 = 6
  • 100 = 4
  • 011 = 3

Binary 000110100011 = Octal 0643.

======================

Post a Comment

0 Comments