Conversion_Between_Bases
Conversion_Between_Bases
Numbers can be converted from one base to another using different methods. Decimal
numbers can be converted to different bases by dividing the decimal number by the new base,
then successively dividing the resulting quotient by the new base until the resulting quotient is
zero. The remainder from each division taken from last to first represents the digits of the
number in the new base.
Decimal to Binary
For example converting the number 1310 to binary
The remainder column taken from bottom to top gives 11012 which is equivalent to 1310.
Decimal to Octal
The same process can be done for other bases simply by using the base number instead of 2.
For example converting the number 8810 to octal (base 8):
The remainder column taken from bottom to top gives 1308 which is equivalent to 8810.
Decimal to Hexadecimal
The same process can be used to convert 12310 to hexadecimal (base 16):
123 / 16 7 11
7 / 16 0 7
Taking the numbers in the remainder column from bottom to top gives 7B16 which is equivalent
to 12310. The letter B is used to represent the digit value 11 in hexadecimal. For digit values 10
to 15 the letters A to F are used: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.
In order to convert from any base to decimal we simply multiply each digit by powers of
the base which increase from right to left, starting with a power of zero. The sum of the resulting
products is the number in base 10.
Binary to Decimal
10112 can be converted to decimal as follows:
1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 =8+0+2+1 = 1110
Octal to Decimal
1308 can be converted to decimal as follows:
1 x 82 + 3 x 81 + 0 x 8 0 = 64 + 24 = 8810
Hexadecimal to Decimal
7B16 can be converted to decimal as follows:
7 x 161 + 11 x 160 = 112 + 11 = 12310
The letter B is replaced with the corresponding digit value 11 in order to perform the conversion.
Hexadecimal and octal can be easily converted to and from binary as 8 and 16 are both
powers of 2. For this reason these two bases, particularly hexadecimal, are used frequently in
computing.
Octal to Binary
Each digit in base 8 can be represented by a combination of three bits in binary. The method
previously discussed can be used for converting each digit to binary.
2 = 010 in binary
5 = 101 in binary
4 = 100 in binary
2548 = 0101011002
The binary number can be converted back to octal by dividing it into groups of three and getting
the decimal value of each combination.
Hexadecimal to Binary
Each digit in hexadecimal can be represented by a combination of four bits in binary. The first
method presented can be used for converting each digit to binary.
2 = 0010 in binary
F (15) = 1111 in binary
A (10) = 1010 in binary
2FA16 = 0010111110102
The binary number can be converted back to hexadecimal by dividing into groups of four and
getting the decimal value for each combination, taking care to represent values 10 to 15 with the
appropriate letter.
The following table shows the equivalent binary, octal, decimal and hexadecimal representation
for the first fifteen positive integers.