0% found this document useful (0 votes)
16 views

Lesson 15.1 Converting Binary Into Octal or Hexadecimal Numbers and Vice Versa

Convert BE4 base 16 to octal (base 8): 1. Convert BE4 base 16 to decimal: BE4 base 16 = (B * 16^1) + (E * 16^0) = (11 * 16^1) + (14 * 16^0) = 1784 decimal 2. Convert 1784 decimal to octal: 1784 = (8^3) * 2 + (8^2) * 4 + (8^1) * 0 + (8^0) * 4 = 2240 octal Therefore, BE4 base 16 = 2240 base 8.

Uploaded by

normurv8940
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lesson 15.1 Converting Binary Into Octal or Hexadecimal Numbers and Vice Versa

Convert BE4 base 16 to octal (base 8): 1. Convert BE4 base 16 to decimal: BE4 base 16 = (B * 16^1) + (E * 16^0) = (11 * 16^1) + (14 * 16^0) = 1784 decimal 2. Convert 1784 decimal to octal: 1784 = (8^3) * 2 + (8^2) * 4 + (8^1) * 0 + (8^0) * 4 = 2240 octal Therefore, BE4 base 16 = 2240 base 8.

Uploaded by

normurv8940
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Converting Binary Numbers (Base 2) into

Octal (Base 8) or Hexadecimal (Base 16) Numbers and Vice Versa

Binary (Base 2) to Octal (Base 8) Numbers


The binary representation of an integer can conveniently be used to find its octal representation. Group the bits
in threes from right to left and replace each group with the corresponding octal digit (4, 2, 1).

Example 1: Express 110100111 to base 8 (octal)

Group the bits in threes from right to left and replace each group with the corresponding octal digit.

110100111 = (110)(100)(111)
= 110 100 111
Multiply each digit by (4, 2 and 1)
= 1(4) + 1(2) + 0(1) 1(4) + 0(2) + 0(1) 1(4) + 1(2) + 1(1)
=4+2+0 4+0+0 4+2+1
=6 4 7
110100111 = 647 base 8

Example 2: Express 1010010001 to base 8 (octal)

Group the bits in threes from right to left and replace each group with the corresponding octal digit.

1010010001 = (1)(010)(010)(001)
= (001)(010)(010)(001) supply 0 as place value
= 001 010 010 001
Multiply each digit by (4, 2 and 1)
= 0(4) + 0(2) + 1(1) 0(4) + 1(2) + 0(1) 0(4) + 1(2) + 0(1) 0(4) + 0(2) + 1(1)
=0+0+1 0+2+0 0+2+0 0+0+1
=1 2 2 1
1010010001 = 1221 base 8

Example 3: Express 11011110 to base 8 (octal)

Group the bits in threes from right to left and replace each group with the corresponding octal digit.

11011110 = (11)(011)(110)
= (011)(011)(110) supply 0 as place value
= 011 011 110
Multiply each digit by (4, 2 and 1)
= 0(4) + 1(2) + 1(1) 0(4) + 1(2) + 1(1) 1(4) + 1(2) + 0(1)
=0+2+1 0+2+1 4+2+0
=3 3 6
11011110 = 336 base 8

A Self-regulated Learning Module 1


Binary (Base 2) to Hexadecimal (Base 16) Numbers
The binary representation of an integer can also be used to find its hexadecimal representation. Group the bits in
fours from right to left and then replace each group with the equivalent hexadecimal digit (8, 4, 2, 1).

Example 4: Express 110100111 to base 16 (hexadecimal)

Group the bits in fours from right to left and then replace each group with the equivalent hexadecimal digit.

110100111 = (1)(1010)(0111)
= (0001)(1010)(0111) supply 0 as place value
= 0001 1010 0111
Multiply each digit by (8, 4, 2 and 1)
= 0(8) + 0(4) + 0(2) + 1(1) 1(8) + 0(4) + 1(2) + 0(1) 0(8) + 1(4) + 1(2) + 1(1)
=0+0+0+1 8+0+2+0 0+4+2+1
=1 10 7
=1 A 7
110100111 = 1A7 base 16

Example 5: Express 1010010001 to base 16 (hexadecimal)

Group the bits in fours from right to left and then replace each group with the equivalent hexadecimal digit.

1010010001 = (10)(1001)(0001)
= (0010)(1001)(0001) supply 0 as place value
= 0010 1001 0001
Multiply each digit by (8, 4, 2 and 1)
= 0(8) + 0(4) + 1(2) + 0(1) 1(8) + 0(4) + 0(2) + 1(1) 0(8) + 0(4) + 0(2) + 1(1)
=0+0+2+0 8+0+0+1 0+0+0+1
=2 9 1
1010010001 = 291 base 16

Example 6: Express 11011110 to base 16 (hexadecimal)

Group the bits in fours from right to left and then replace each group with the equivalent hexadecimal digit.

11011110 = (1101)(1110)
= 1101 1110
Multiply each digit by (8, 4, 2 and 1)
= 1(8) + 1(4) + 0(2) + 1(1) 1(8) + 1(4) + 1(2) + 0(1)
=8+4+0+1 8+4+2+0
= 13 14
=D E
11011110 = DE base 16

A Self-regulated Learning Module 2


Octal (Base 8) or Hexadecimal (Base 16) to Binary (Base 2) Numbers
The techniques are also reversible, that is, the octal and hexadecimal representations of integers can be used to
find their binary representations.

Octal (Base 8) to Binary (Base 2)

Example 7: Express 236 base 8 to binary (base 2)

Rewrite the each digit as a sum using only 4, 2 or 1 as numerals


236 base 8 = 2 3 6
=2 2+1 4+2
= 0(4) + 1(2) + 0(1) 0(4) + 1(2) + 1(1) 1(4) + 1(2) + 0(1)
= 010 011 110
236 base 8 = (010)(011)(110)
236 base 8 = (10)(011)(110) remove 0 on the farthest left
236 base 8 = 10011110

Example 8: Express 101 base 8 to binary (base 2)

Rewrite the each digit as a sum using only 4, 2 or 1 as numerals


101 base 8 = 1 0 1
= 0(4) + 0(2) + 1(1) 0(4) + 0(2) + 0(0) 0(4) + 0(2) + 1(1)
= 001 000 001
101 base 8 = (001)(000)(001)
101 base 8 = (1)(000)(001) remove 0s on the farthest left
101 base 8 = 1000001

Example 9: Express 2457 base 8 to binary (base 2)

Rewrite the each digit as a sum using only 4, 2 or 1 as numerals


2457 base 8 = 2 4 5 7
=2 4 4+1 4+2+1
= 0(4) + 1(2) + 0(1) 1(4) + 0(2) + 0(1) 1(4) + 0(2) + 1(1) 1(4) + 1(2) + 1(1)
= 010 100 101 111
2457 base 8 = (010)(100)(101)(111)
2457 base 8 = (10)(100)(101)(111) remove 0 on the farthest left
2457 base 8 = 10100101111

A Self-regulated Learning Module 3


Hexadecimal (Base 16) to Binary (Base 2)

Example 10: Express 957 base 16 to binary (base 2)

Rewrite the each digit as a sum using only 8, 4, 2 or 1 as numerals


957 base 16 = 9 5 7
=8+1 4+1 4+2+1
= 1(8) + 0(4) + 0(2) + 1(1) 0(8) + 1(4) + 0(2) + 1(1) 0(8) + 1(4) + 1(2) + 1(1)
= 1001 0101 0111
957 base 16 = (1001)(0101)(0111)
957 base 16 = 100101010111

Example 11: Express 2BE base 16 to binary (base 2)

Rewrite the each digit as a sum using only 8, 4, 2 or 1 as numerals


2BE base 16 = 2 B E
=2 11 14
=2 8+2+1 8+4+2
= 0(8) + 0(4) + 1(2) + 0(1) 1(8) + 0(4) + 1(2) + 1(1) 1(8) + 1(4) + 1(2) + 0(1)
= 0010 1011 1110
2BE base 16 = (0010)(1011)(1110)
2BE base 16 = (10)(1011)(1110) remove 0s on the farthest left
2BE base 16 = 1010111110

Example 12: Express ACE base 16 to binary (base 2)

Rewrite the each digit as a sum using only 8, 4, 2 or 1 as numerals


ACE base 16 = A C E
= 10 12 14
=8+2 8+4 8+4+2
= 1(8) + 0(4) + 1(2) + 0(1) 1(8) + 1(4) + 0(2) + 0(1) 1(8) + 1(4) + 1(2) + 0(1)
= 1010 1100 1110
ACE base 16 = (1010)(1100)(1110)
ACE base 16 = 101011001110

A Self-regulated Learning Module 4


Unfortunately we do not have a shortcut method converting octal number to hexadecimal number and vice versa.
The way we do to convert an octal number into hexadecimal is to convert octal number into a decimal number
then convert the decimal number into a hexadecimal number. This is also true from hexadecimal number into
octal number.

Octal (Base 8) to Hexadecimal (Base 16)

Example 13: Express 765base 8 to hexadecimal (bae 16) number

First, convert 765base 8 into a decimal number


Octal expansion:
765base 8 = 7(82) + 6(81) + 5(80)
= 7(64) + 6(8) + 5(1)
= 448 + 48 + 5
765base 8 = 501

Next, convert 501 into hexadecimal using the algorithm with 16 as divisor (base 16)
501 = (16)(quotient q) + (remainder r)
501 = (16)(q) + r

501 = (16)(31) + 5 5
Take q = 5 as the new dividend 31 = (16)(1) + 15 F
Take q = 1 as the new dividend 1 = (16)(0) + 1 1
(stop when q = 0) 15 = F in hexadecimal

he answer is the remainder in reverse order


Thus, 765base 8 = 1F5 base 16

A Self-regulated Learning Module 5


Hexadecimal (Base 16) to Octal (Base 8)

Example 14: Express BE4base 16 to octal (base 8) number

First, convert BE4base 16 into decimal number


Hexadecimal expansion:
BE4base 16 = B(162) + E(161) + 4(160)

Since B = 11 and E = 14 we need to rewrite it as


BE4base 16 = 11(162) + 14(161) + 4(160)
= 11(256) + 14(16) + 4(1)
= 2816 + 224 + 4
BE4base 16 = 3044

Next convert 3044 into octal (base 8) number using the algorithm with 8 as divisor
3044 = (8)(quotient q) + remainder r
3044 = (8)(q) + r

3044 = (8)(380) + 4
Take q = 380 as the new dividend 380 = (8)(47) + 4
Take q = 47 as the new dividend 47 = (8)(5) + 7
Take q = 5 as the new dividend 5 = (8)(0) + 5
(stop when q = 0)

The answer is the remainder in reverse order


Thus, BE4base 16 = 5744 base 8

See more examples found in your PowerPoint Presentation (Base Number System)

A Self-regulated Learning Module 6

You might also like