Number Conversion - Binary Octal Hexadecimal

Conversion

Share

In this number conversion tutorial we are learning to convert number between three commonly used number system, Binary, Octal and Hexadecimal.

In this tutorial we will see six examples:
1. Binary to Octal conversion
2. Octal to Binary conversion
3. Binary to Hexadecimal conversion
4. Hexadecimal to Binary conversion
5. Octal to Hexadecimal conversion
6. Hexadecimal to Octal conversion

Before we start lets talk a little about the number system that we are going to cover in this tutorial.

Decimal Number System

In decimal number system we use ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Decimal implies base 10.

Binary Number System

In Binary number system we use two digits 0 and 1. Binary implies base 2.

Octal Number System

In Octal number system we use eight digits 0, 1, 2, 3, 4, 5, 6 and 7. Octal implies base 8.

Hexadecimal Number System

In hexadecimal number system we use ten digits and six english alphabet letters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.
10 is denoted as A
11 is denoted as B
12 is denoted as C
13 is denoted as D
14 is denoted as E
15 is denoted as F
Hexadecimal implies base 16.

Conversion Table

Following is the conversion table that we will use as a reference to perform conversion operations.

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

1. Binary to Octal conversion

To convert a binary number into octal we follow the given steps
1. Divide the binary digits into groups of 3 digits, starting from the right.
2. Convert each group of 3 binary digits into 1 octal digit.

Convert Binary number 1001012 into Octal form


Step 1. Make groups of 3 digits from right

1001012

Groups: 1002  1012

Step 2. Convert each 3 digits group into 1 octal digit

1012 = 58
1002 = 48

so, 1001012 = 458

2. Octal to Binary conversion

To convert an Octal number into Binary we follow the following steps
1. Convert each octal digits into 3 digits binary group
2. Combine the groups

Convert Octal number 458 into Binary form


Step 1. Convert each octal digit into 3 digits binary group

458

Groups: 48  58

58 = 1012
48 = 1002

Step 2. Combine the groups

so, 458 = 1001012

3. Binary to Hexadecimal conversion

To convert a binary number into hexadecimal we follow the given steps
1. Divide the binary digits into groups of 4 digits, starting from the right
2. Convert each group of 4 binary digits into 1 hexadecimal digit

Convert Binary number 101001012 into Hexadecimal form


Step 1. Make groups of 4 digits from right

101001012

Groups: 10102  01012

01012 = 516
10102 = 416

Step 2. Combine the groups

so, 101001012 = 4516

4. Hexadecimal to Binary conversion

To convert a hexadecimal number into binary we follow the given steps
1. Convert each hexadecimal digit into group of 4 digits binary
2. Combine the groups

Convert Hexadecimal number A516 into Binary form


Step 1. Convert each hexadecimal digit into group of 4 digits binary

A516

Groups: A16  516

516 = 01012
A16 = 10102

Step 2. Combine the groups

so, A516 = 101001012

5. Octal to Hexadecimal conversion

To convert an octal number into hexadecimal we follow the given steps
1. Convert each octal digit into groups of 3 digits binary
2. Combine the groups from step 1

3. Divide the binary digits from step 2 into groups of 4 digits, starting from the right
4. Convert each group of 4 binary digits into 1 hexadecimal digit

Convert Octal number 258 into Hexadecimal form


Step 1. Convert each octal digit into groups of 3 digits binary

258

Groups: 28  58

58 = 1012
28 = 0102

Step 2. Combine the groups

so, 258 = 0101012

Step 3. Divide the binary digits from step 2 into groups of 4 digits, starting from the right

Groups: 00012   01012

Step 4. Convert each group of 4 binary digits into 1 hexadecimal digit

01012 = 516
00012 = 116

so, 258 = 1516

6. Hexadecimal to Octal conversion

To convert a hexadecimal number into octal we follow the given steps
1. Convert each hexadecimal digit into groups of 4 digits binary
2. Combine the groups from step 1

3. Divide the binary digits from step 2 into groups of 3 digits, starting from the right
4. Convert each group of 3 binary digits into 1 octal digit

Convert Hexadecimal number 1516 into Octal form


Step 1. Convert each hexadecimal digit into groups of 4 digits binary

1516

Groups: 116  516

516 = 01012
116 = 00012

Step 2. Combine the groups

so, 1516 = 000101012

Step 3. Divide the binary digits from step 2 into groups of 3 digits, starting from the right

Groups: 0002  0102   1012

Step 4. Convert each group of 4 binary digits into 1 hexadecimal digit

1012 = 58
0102 = 28
0002 = 08

so, 1516 = 0258 = 258

Recently Added