Skip to main content

Number Systems

Binary Number System and Its Representation

3 min read

In mathematics and digital electronics, a binary number is expressed in the base-2 number system, using only two symbols: "0" and "1".

What is the binary number system?

Another number system that became famous after the decimal is the binary number system, which has only two digits, 0 and 1.

If a number system has n digits, we say that the base of the number system is n. So the binary number system can also be called the base-2 number system.

Why does a computer understand binary?

The simplest explanation would be that a computer is an electrical device, and all electrical devices understand electrical signals, which have only two states.

Example

If we have an input wire to this machine, there are only two possible states for this wire: either the current is flowing through this wire, or it is not flowing through this wire. If the current is flowing, we say that the state of this wire is signalled. And we say that the signal state corresponds to 1.

If the current is not flowing, it is not signalled. The not signal state corresponds to 0. So, 1 and 0, in binary, translate to a signal or non-signal in an electrical device, and we can have multiple wires or inputs to represent multiple ones and zeros.

Powers of 2

Power of twoBinaryDecimal Value
2^000011
2^100102
2^201004
2^310008
2^40001 000016
2^50010 000032
2^60100 000064
2^71000 0000128
2^80001 0000 0000256
2^90010 0000 0000512
2^100100 0000 00001,024

The powers of 2 are increasing, so the bits go from right to left based on the decimal value given as input. All other left bits will be 0.

For example:

125 can be represented as 01111101 in the computer binary system. Anything in computer language gets converted into a binary number system.

What do binary numbers represent?

In mathematics and digital electronics:

  • A binary number is expressed in the base-2 or binary number system.
  • It uses only two symbols: typically “0” (zero) and “1” (one).

The base-2 number system is a positional notation with a radix of 2. Each digit is referred to as a bit.

Binary counting

Binary counting follows the same procedure, except only the symbols 0 and 1 are available. Thus, after a digit reaches 1 in binary, an increment resets it to 0 but also causes an increment of the next digit to the left.

0000,
0001, (rightmost digit starts over, and next digit is incremented)
0010, 0011, (rightmost two digits start over, and next digit is incremented)
0100, 0101, 0110, 0111, (rightmost three digits start over, and the next digit is incremented)
1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111,…

Binary to decimal conversion

In the binary system, each digit represents an increasing power of 2, with the rightmost digit representing 20, the next representing 21, then 22, and so on. The value of a binary number is the sum of the powers of 2 represented by each “1” digit. For example, the binary number 100101 is converted to decimal form as follows:

1001012 = [ ( 1 ) x 25 ] + [ ( 0 ) x 24 ] + [ ( 0 ) x 23 ] + [ ( 1 ) x 22 ] + [ ( 0 ) x 21 ] + [ ( 1 ) x 20 ]

1001012 = [ ( 1 ) x 32 ] + [ ( 0 ) x 16 ] + [ ( 0 ) x 8 ] + [ ( 1 ) x 4 ] + [ ( 0 ) x 2 ] + [ ( 1 ) x 0 ]

1001012 = 3710

Decimal to binary representation

Below is the 32-bit binary representation.

5 -> 00000000 00000000 00000000 00000101

Representing decimals & ASCII in binary

A computer only understands byte-code made of 0’s and 1’s. We must represent every decimal character as binary digits so a computer can understand our instructions.

Decimal numbers in binary (8-bit representation)

Each software programming language uses its pre-defined sizes for primitive data types. So, let’s represent the rightmost 8 bits (1 byte) in binary.

Decimal Number8-bit binary representation
00000 0000
10000 0001
20000 0010
30000 0011
40000 0100
50000 0101
60000 0110
70000 0111
80000 1000
90000 1001
100000 1010

ASCII - Binary character table

Alphabets in binary (capital letters & lowercase letters)

LetterASCII CodeBinaryLetterASCII CodeBinary
a09701100001A06501000001
b09801100010B06601000010
c09901100011C06701000011
d10001100100D06801000100
e10101100101E06901000101
f10201100110F07001000110
g10301100111G07101000111
h10401101000H07201001000
i10501101001I07301001001
j10601101010J07401001010
k10701101011K07501001011
l10801101100L07601001100
m10901101101M07701001101
n11001101110N07801001110
o11101101111O07901001111
p11201110000P08001010000
q11301110001Q08101010001
r11401110010R08201010010
s11501110011S08301010011
t11601110100T08401010100
u11701110101U08501010101
v11801110110V08601010110
w11901110111W08701010111
x12001111000X08801011000
y12101111001Y08901011001
z12201111010Z09001011010

Reading Progress