Decimal Conversion Explained: Binary, Octal and Hexadecimal Worked Examples
Learn one dependable method for converting values between decimal, binary, octal and hexadecimal, including fractions, shortcuts and checks.
KnowledgeGate Team
Exam prep & CS education

Memorising a conversion rule is easy. Errors begin when division remainders must be reversed, fractional digits must be read in the other direction, or A to F appear in hexadecimal. Place values, repeated division, repeated multiplication and binary grouping provide the conversion methods for binary, octal and hexadecimal. Choose the right method, convert the answer back for verification, and reject invalid digits before doing any arithmetic. Fractions cost the most marks, so each fractional route carries its reading direction and a test for whether the expansion terminates at all.
Number-system basics: radix, digits and place value
A number system has a base, or radix, b. In a positional numeral, each digit d_i contributes d_i x b^i, and every digit must satisfy 0 <= d_i < b. Decimal uses 0-9, binary uses 0-1, octal uses 0-7, and hexadecimal uses 0-9, A-F. In hexadecimal, A=10, B=11, C=12, D=13, E=14, and F=15.
The subscript matters. (101)_10 is one hundred and one, while (101)_2=1x2^2+0x2^1+1x2^0=(5)_10. Similarly, (101)_8=(65)_10 and (101)_16=(257)_10. Always attach a base to an ambiguous numeral.
Decimal conversion sits inside CS Fundamentals. Complements, signed representation, BCD and Gray code belong to the wider treatment in Number Systems and Base Conversions: GATE Worked Examples. Decimal stays the hub: positional expansion brings a numeral in, and repeated division and multiplication take it back out, fraction included.
Convert any supported base to decimal by expanding place values
For (101101.101)_2, integer weights run right to left from 2^0; fractional weights run left to right from 2^-1:
1x2^5 + 0x2^4 + 1x2^3 + 1x2^2 + 0x2^1 + 1x2^0 + 1x2^-1 + 0x2^-2 + 1x2^-3
=32+8+4+1+0.5+0.125=(45.625)_10.
The same value appears as (55.5)_8=5x8^1+5x8^0+5x8^-1=40+5+0.625=(45.625)_10, and (2D.A)_16=2x16^1+13x16^0+10x16^-1=32+13+0.625=(45.625)_10. The first place after the point is always b^-1, not b^0.
Check legality first. (10201)_2, (728)_8, and (19G)_16 are invalid because 2, 8, and G do not belong to those bases. Never silently reinterpret them.

Convert a decimal integer by repeated division
To convert (156)_10 to binary, divide repeatedly and keep every remainder:
Division | Quotient | Remainder |
|---|---|---|
| 78 | 0 |
| 39 | 0 |
| 19 | 1 |
| 9 | 1 |
| 4 | 1 |
| 2 | 0 |
| 1 | 0 |
| 0 | 1 |
Read upward: (156)_10=(10011100)_2.
For octal: 156/8=19 remainder 4; 19/8=2 remainder 3; 2/8=0 remainder 2. Thus (156)_10=(234)_8. For hexadecimal: 156/16=9 remainder 12=C; 9/16=0 remainder 9. Thus (156)_10=(9C)_16.
Remainders are reversed because the first is the coefficient of b^0, the least-significant digit. Reverse checks give 128+16+8+4=156, 2x64+3x8+4=156, and 9x16+12=156.
Convert a decimal fraction by repeated multiplication
For (0.6875)_10, multiply by the target base and read recorded integer parts from top to bottom:
0.6875x2=1.375: record1, retain0.375.0.375x2=0.75: record0, retain0.75.0.75x2=1.5: record1, retain0.5.0.5x2=1.0: record1, then stop.
Therefore (0.6875)_10=(.1011)_2. In octal, 0.6875x8=5.5 records 5, then 0.5x8=4.0 records 4, giving (.54)_8. In hexadecimal, 0.6875x16=11.0 records B, giving (.B)_16.
Combining integer and fraction results:
(156.6875)_10=(10011100.1011)_2=(234.54)_8=(9C.B)_16.
The reverse check is 9x16+12+11/16=156.6875.
A fraction terminates in base b only when its reduced denominator has no prime factor outside the factors of b. Since 0.6875=11/16, it terminates in bases 2, 8 and 16. By contrast, (0.1)_10=(.000110011001...)_2. Keeping eight fractional bits gives (.00011001)_2=(0.09765625)_10, an approximation. State whether you truncated or rounded whenever an expansion does not terminate.

Use binary grouping for fast octal and hexadecimal conversion
One octal digit represents three bits because 8=2^3; one hexadecimal digit represents four because 16=2^4. Group outward from the radix point. Pad only at the far left of the integer part or far right of the fraction.
For octal, (1101011110.1011)_2 becomes 1|101|011|110.101|100, so the result is (1536.54)_8. The two final zeros are padding. For hexadecimal, group it as 0011|0101|1110.1011, giving (35E.B)_16.
Both equal (862.6875)_10: 1x512+5x64+3x8+6+5/8+4/64=862.6875, and 3x256+5x16+14+11/16=862.6875. Convert octal to hexadecimal through binary: (73)_8=(111011)_2=(3B)_16. Grouping octal digits directly into fours has no positional basis. Choose by what you already hold: grouping is fastest once a binary form exists, while repeated division and multiplication stay the only direct route out of decimal.
Conversion traps and the exact repair for each
Mistake | Why it fails | Exact repair |
|---|---|---|
Read division remainders top-down | The first remainder is the least-significant digit | Read from the last row upward |
Read fraction products bottom-up | The first recorded integer is the first fractional digit | Read recorded integers top-down |
Start a fraction at | The point separates non-negative and negative powers | Start at |
Accept a digit | That digit does not exist in the base | Validate every digit first |
Treat hexadecimal |
| Read it only within its stated base |
Group from the outer ends | Place alignment changes | Group outward from the radix point |
Write a repeating result as finite equality | Truncation changes the value | Use |
For example, reading the remainders for (156)_10 top-down produces (00111001)_2=(57)_10. Treating the first bit in (.101)_2 as 2^0 gives 1.25, but the correct value is 1/2+1/8=0.625. Grouping (1101011110)_2 from the left as 110|101|111|0 is misaligned; right-to-left grouping gives 1|101|011|110=(1536)_8.
Use this routine: validate digits, attach the base, choose expansion or division and multiplication, preserve the reading direction, then convert back to decimal. For a repeating fraction, compare within the stated bit precision.
Representative exam-style conversion patterns and rapid checks
Stable question forms include evaluating a numeral in decimal, converting an integer or fraction, detecting an invalid digit, filling a place value, grouping binary into octal or hexadecimal, comparing unlike bases, and deciding whether an expansion terminates at a stated precision.
Try these rapid checks:
Convert
(3A7)_16to decimal.Answer:
3x256+10x16+7=(935)_10.Convert
(73)_10to binary, octal and hexadecimal.Answer:
(73)_10=(1001001)_2=(111)_8=(49)_16; the binary and octal checks both give64+8+1=73, and the hexadecimal check gives4x16+9=73.Convert
(0.3125)_10to binary.Answer:
(.0101)_2, because0.3125=1/4+1/16.Is
(128)_8valid?Answer: No. Octal has no digit
8.Evaluate
(11111111)_2as an unsigned positional numeral.Answer:
(255)_10. A signed result needs an explicitly named representation and width.
KnowledgeGate carries about 40 practice questions on number-system basics and decimal conversion. Continue with Number System MCQs: 12 Solved (GATE, with answers) for a checked practice set.
Decimal conversion: the short version and next step
Validate every digit.
Attach the base.
Use powers to convert into decimal.
Use repeated division for a decimal integer.
Use repeated multiplication for a decimal fraction.
Use 3-bit or 4-bit groups only between binary and octal or hexadecimal.
Keep two anchors: (101101.101)_2=(45.625)_10 and (156.6875)_10=(10011100.1011)_2=(234.54)_8=(9C.B)_16.
Now redo (156.6875)_10 without looking and convert one result back. Both parts should return to (156.6875)_10, or a non-terminating result should name its precision and approximation rule.
Use Zero to Hero, Complete CS Course when your wider computer-science foundation needs a structured rebuild. Choose GATE Guidance by Sanchit Sir for a broader GATE CS preparation route.
Keep learning

Binary Arithmetic Operations Explained: Rules and Worked Examples
Learn binary addition, subtraction, multiplication and division with aligned worked examples, then separate carry, borrow and two's-complement overflow.

1's Complement Explained: Binary Conversion, Addition and Worked Examples
Learn how fixed-width 1's complement numbers represent negatives, why zero has two encodings, and how end-around carry works through exact examples.

Two's Complement Arithmetic Explained: Signed Ranges, Subtraction, Overflow and Worked Examples
Build a reliable 8-bit method for encoding signed values, subtracting with complements, detecting overflow, extending signs and checking every result.

Functional Completeness in Digital Logic: NAND, NOR and Worked Examples
Learn what makes a Boolean operator set complete, how NAND and NOR recover a standard basis, and how to verify a four-gate NAND construction.