Why do we need various number systems in computer science?

By: Prof. Fazal Rehman Shamil

 Why do we need various number systems in computer science?

Computers cannot understand human languages. So, to process commands and instructions given by programmers, they use different systems typically known as number systems.

The most widely used number systems are:

  • Binary
  • Octal
  • Decimal
  • Hexadecimal


All of these are equally important. In the article below, you will learn what these numbers are and some of their applications.

1.  Binary system

Binary system aka Base-2 number system is used by computers to operate. All the data stored in a computer consists of binary numbers. It is the most widely used system.

Binary consists of two units 0 and 1, known as bit. Individually the 0 bit means NO (False) while 1 bit means YES (True).

These bits are combined in a group of 8 bytes, to represent multiple characters and values. One byte can represent 256 values depending on its arrangement of bit units.

Binaries are stored in computer data as “Machine code”. This way its CPU can execute programs set by the computer scientists.

In the binary system, there is no representation for negative integers because we only have 0 and 1. No -ve sign no +ve sign. So to represent such numbers and perform similar operations, programmers use two’s complement.

You can find two’s complement of binary numbers using two’s complement calculator.


Source code is not to be confused with Machine code. Source code is designed by programmers in languages such as HTML, Python, etc.

To understand this source code, the computer converts it into binary numbers, Machine code.

Use of binary number system:

  • It can be used to represent pixels of an image.
  • It also used to represent On and OFF in a circuit.
  • True and False statements.

Conversion in Binary:

Although it is mostly used in computers, humans can also learn this system easily.


Convert 345 into Binary Number.


  1. Perform repeated division on 345 with 2 as a divisor.
Binary Conversion
Binary Conversion
  1. Start writing from bottom to top. 10010
  1. Complete 8-bit byte by adding zeros on the left. 00010010

2.  Octal Number system

Base-8 is a number system that has 8 as the radix. The 8 digits used in this system are 0, 1, 2, 3, 4, 5, 6, 7. All of these representations can be arranged variously to make more octal representations.

The octal number system is a little confusing and needs the practice to understand it completely. An Octal number is usually expressed with 8 as subscript e.g..

Computers cannot read octal numbers directly. That’s why they are converted into binary first.

In octal numbers, digits above 7 are represented differently. For example, 8 is represented as 10 which is actually 1 + 0, not the decimal 10. To clarify it even more.

Octal Numbers:

Decimal  Number 3-bit Binary Number Octal Number


























001 000

10 (1+0)


001 001

11 (1+1)

Use of Octal Numbers:

  1. In UNIX
  2. Computing graphics
  3. File Protection

Conversion in Octal:

Conversion in octal is quite similar to conversion in binary.


Convert 130 in Octal.


  1. Perform repeated division on 130.
Conversion in Octal
Conversion in Octal
  1. Start writing from bottom to top.


3.  Decimal system

The decimal system aka the Base-10 system is the number system with which almost every human is familiarized. Even an uneducated person can understand this system.

The reason is that we use it in daily life in finance, counting e.t.c. The numbers used in the denary system are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

In the denary system, the significance of each number increases by 10 times as we move from right to left. E.g in the number 56, 5 is 10 times more valuable than the number 6.

Uses of the decimal system:

  • Finance
  • Calendar
  • Counting

Conversion in decimal:

There isn’t much to do in decimal conversion because it is the number system we are using. This means that the numbers we use are already presented in the denary system.

But we can learn to convert binary numbers in the decimal system.


Convert 10010101 in decimal.


  1. First, write 2 under each bit with power the same as the position of it.
Conversion in decimal
Conversion in decimal
  1. Now, multiply the numbers with their respected binary bit and add them. i.e.,

=   128 + 16 + 4 + 1

=   149

4.  Hexadecimal system

The last and the most complex number system is the hexadecimal system. It is difficult to learn as compared to other number systems.

This number system makes several things convenient such as the representation of bytes. Only 2 hexadecimal numbers are required to represent an 8-bit byte of binary numbers.


It is also known as base-16 and the digits and alphabets used in this system are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.


The alphabet A represents decimal number 10, B represents decimal number 11, and so on.

Uses of Hexadecimal:

  • Memory locations
  • De-bugging
  • To define colors on web pages e.g A shade of red is represented by ff0000.


Decimal Number 4-bit Binary Number Hexadecimal Number
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
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
16 0001 0000 10 (1+0)
17 0001 0001 11 (1+1)


Conversion in hexadecimal:

To convert decimal into hexadecimal, the same method as the octal conversion is used.


Convert 510 in hexadecimal.


  1. Perform repeated division on 510.
Conversion in hexadecimal
Conversion in hexadecimal
  1. Write from bottom to top and use the respected alphabets where needed.

14 = E, 15 = F, 1 = 1

  1. Hence,

510 = (1FE)16


Each number system is important and has various applications. It is due to these number systems that modern computers can perform much more tasks than the old ones.

Although these systems are used in computer programming, they can be easily learned because ultimately they all are related to the decimal number system that humans use.

Prof. Fazal Rehman Shamil

Leave a Reply

Your email address will not be published. Required fields are marked *