Number Systems: Conversion involved a binary number system
Binary (Base 2), quaternary (base 4), octal (base 8), hexadecimal (base 16) systems
Number Systems – Part 1 and Number Systems – Part 2 discuss meaning of number systems (or numbering systems) and how to convert a number from one base to another base via the decimal number system. This article will discuss the relationship between binary numbers and quaternary, octal, and hexadecimal numbers, and describe a simpler way to convert these numbers to binary numbers and vice versa.
A. Conversion to binary numbers
Quaternary numbers (Base-4)
To convert a quaternary number (base 4), for example 203.12, to a binary number (base 2), note that 4 = 22, and number 203.12 can be expressed as Eq. A.1 (as stated in Number Systems – Part 1)
Substituting 4 = 22 in Eq. A.1, we get
In the binary number system, numbers 0, 1, 2, and 3 are represented as
Thus Eq. A.2 can be written as
or
or
Comparing Eqs. A.1, A.3, and A.4b, it can be concluded that to convert a quaternary number to a binary number, we can simply replace each quaternary digit with its equivalent 2-bit binary. Matching color for each quaternary digit and its equivalent 2-bit binary number in Eq. A.4c is used to demonstrate this conversion approach as shown below (note that the binary number 110011.0110 can be expressed as 110011.011)
Octal numbers (Base-8)
A similar method can be used for conversion of octal numbers to binary numbers, except that, as the base of an octal number is 8, which is 23, an octal digit must be replaced with a 3-bit binary number instead of 2-bit. 3-bit binary number for each of eight octal digits can be derived in the same way as that of Eq. A.3; and similarly 4-bit binary numbers for 16 hexadecimal digits. 2-bit, 3-bit, and 4-bit binary numbers for each of quaternary, octal, and hexadecimal digits are shown in Table A.1 below.
For example, conversion of octal number 72 to binary:
Converting octal number 72.03 to binary:
Hexadecimal numbers (Base-16)
Similarly, to convert a hexadecimal number to binary number, note that hexadecimal number has a base of 16, which is 24, so a 4-bit binary number will be used to replace each hexadecimal digit.
For example, to convert hexadecimal number A1E to binary number, we substitute A, 1, and B with their respective 4-bit binary number as below
and converting hexadecimal number A1E.2D to binary number can be done in a similar fashion:
B. binary numbers to quaternary, octal, & hexadecimal numbers
Conversion of a binary number to quaternary, or octal, or hexadecimal number is the reverse of the above process with 2-bit binary for quaternary, 3-bit for octal, and 4-bit for hexadecimal. Also, for the whole number part, the replacement starts from right to left, and padding of zeros may be needed to the last left digit to make up for its respective bit size. For the fractional part, if any, the replacement starts from the fractional point and from left to right, and padding of zeros may be needed to the last right digit to make up for the respective bit size.
Quaternary Numbers
To convert a binary number, says 1011, to quaternary, we start with substituting the last two digits, 11, with 3 , then binary digits 10 with 2 and adding it to the left of 3 to make quaternary number 23.
![](https://studycorner.com.au/wp-content/uploads/2022/07/2-4aclr.png)
To convert binary number 11011, after replacing 11 with 3 and 10 with 2, a zero is padded to the left of the remaining binary digit 1 to make a 2-bit binary 01, which is 1 in quaternary system. The quaternary result is 123, and the padded zero is highlighted in red as shown below,
![](https://studycorner.com.au/wp-content/uploads/2022/07/2-4bclr.png)
To convert binary number 11011.011 to quaternary number, the whole number (before the fractional point) is equal to quaternary 123, as explained earlier. For the fractional part, we start with 01, the first two digits immediately on the right of the fractional point, which has quaternary value of 1 (see Table A.1); we then add a zero to the right of the remaining 1 to make 2-bit binary 10. The resulted quaternary number is shown below, padded zeros are in red color for the whole number part and green for the fractional part.
![](https://studycorner.com.au/wp-content/uploads/2022/07/2-4cclr.png)
Octal numbers
To convert binary number 1011 to octal, similar steps can be used but with 3-bit binary.
![](https://studycorner.com.au/wp-content/uploads/2022/07/2-8aclr-1.png)
Convert binary 11011.011 to octal number:
![](https://studycorner.com.au/wp-content/uploads/2022/07/2-8bclr.png)
Hexadecimal Numbers
Converting binary number 1011 to hexadecimal number
![](https://studycorner.com.au/wp-content/uploads/2022/07/2-16aclr-1.png)
Converting binary number 11011.011 to hexadecimal number
![](https://studycorner.com.au/wp-content/uploads/2022/07/2-16bclr.png)
Binary equivalents of quaternary, octal, & hexadecimal numbers
Binary number equivalents for quaternary, octal, and hexadecimal numbers
Number Systems – Part 1: Conversion to Decimal number system
Number Systems – Part 2: Conversion of decimal numbers to other number systems
Check your number
Enter your number (Number), its base (Number Base), and the new number base (New Base). The result (New Number) will appear inside the yellow box.
Convert a number to a different number system
Number Base: | New Base: |
Number: | New Number: |