Number System Conversions
Direct methods between binary, octal, decimal, hex.
Number system conversion is tested in almost every GATE paper and forms the foundation of how computers store and process integers. ALUs in processors like the ARM Cortex-M4 internally handle binary, yet programmers interact through decimal and hex interfaces.
Core Concept
Four number systems appear in digital electronics: decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16). Any number in one base can be converted to any other. The method depends on the direction of conversion.
Decimal to any base: repeatedly divide by the target base and collect remainders from bottom to top. Decimal to binary divides by 2, decimal to octal divides by 8, decimal to hex divides by 16. For the fractional part, multiply repeatedly and collect the integer parts from top to bottom.
Binary to hex and binary to octal use grouping shortcuts. Group 4 bits from the LSB for hex, group 3 bits from the LSB for octal. These shortcuts avoid going through decimal and are much faster in GATE time-pressured conditions. This is the method used internally by assemblers when displaying addresses.
Boolean Expression
The general positional notation formula is: N = Σ dᵢ × Bⁱ where B is the base and dᵢ is the digit at position i. For fractional parts, positions carry negative exponents. This formula is the basis of all to-decimal conversions.
Given:
Convert (156.25)₁₀ to binary
Formula / Rule:
Integer part: divide by 2, read remainders bottom to top
Fractional part: multiply by 2, read integer parts top to bottom
Step by step (integer 156):
156 ÷ 2 = 78 remainder 0
78 ÷ 2 = 39 remainder 0
39 ÷ 2 = 19 remainder 1
19 ÷ 2 = 9 remainder 1
9 ÷ 2 = 4 remainder 1
4 ÷ 2 = 2 remainder 0
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1 (stop)
Integer binary (read bottom to top): 10011100
Step by step (fraction 0.25):
0.25 × 2 = 0.50 integer part = 0
0.50 × 2 = 1.00 integer part = 1 (stop, remainder 0)
Fractional binary (read top to bottom): .01
Final Answer:
(156.25)₁₀ = (10011100.01)₂Exam Tip: For binary-to-octal, always pad the binary number with leading zeros on the left of the integer part and trailing zeros on the right of the fractional part to make the group count exact. Forgetting to pad is the most common grouping error. Also note: octal and hex shortcuts only work starting from the binary point, not from the MSB of the full number.
Key Properties
- Decimal to binary: divide integer part by 2; multiply fraction by 2
- Binary to decimal: sum positional weights (1, 2, 4, 8, 16 ...)
- Binary to hex: group 4 bits from binary point outward; one group = one hex digit
- Binary to octal: group 3 bits from binary point outward; one group = one octal digit
- Octal to hex (or vice versa): go through binary as an intermediate step
- Fractional conversion may produce a non-terminating sequence; GATE problems usually stop at 4–5 bits
- All modern CPUs natively operate in binary; other bases are human-readable representations only
Quick Revision
- Dec to binary: divide by 2, remainders bottom-up
- Dec to hex: divide by 16, remainders bottom-up; replace 10–15 with A–F
- Binary to hex: group 4 bits from LSB; pad with leading zeros if needed
- Binary to octal: group 3 bits from LSB; pad if needed
- Fraction: multiply by base; collect integer part top-down
- Octal to hex: convert to binary first, then regroup
- Positional formula N = Σ dᵢ × Bⁱ works for all bases
- Exam trap: reading the repeated-division remainders top-to-bottom gives the reversed (wrong) result
Number System Conversions
Test your speed and accuracy converting directly between binary, octal, decimal, and hexadecimal.
Q1.The octal number 74 converted directly to hexadecimal (without converting to decimal as an intermediate) is:
Related Articles
Binary Number System
Base-2, place values, binary to decimal conversion.
9 min read
Octal Number System
Base-8, octal to binary and decimal conversion.
5 min read
Signed Number Representation
Sign magnitude, 1s complement, 2s complement, range.
10 min read
Gray Code
Reflected binary code, binary to Gray conversion.
4 min read
Binary Subtraction
Direct subtraction and complement methods.
8 min read