Base Conversion Explained: Binary, Octal, Decimal and Hexadecimal Worked Examples

Learn one reliable workflow for converting integers and fractions across bases, with checked examples, shortcut rules and quick questions for practice.

KnowledgeGate Team

Exam prep & CS education

Updated 26 Oct 20267 min read

Most wrong base-conversion answers come from mixing two procedures, reading remainders in the wrong order, or grouping bits from the wrong end of the radix point. The hard cases are the ones where neither side is decimal and neither is a power of two: base 5 to base 7, base 10 to base 6, or a numeral whose base is itself the unknown. All of them reduce to two operations, expansion into decimal and repeated division or multiplication out of it, joined by a decimal bridge and closed by a reverse check that turns a guess into a verified answer.

Base conversion starts with place value in any radix

A positional numeral (d_k...d_1d_0.d_-1d_-2...)_b has value sum(d_i x b^i). Powers b^0, b^1, b^2... extend left from the units place, while b^-1, b^-2... extend right. The base must be at least 2, and every digit must satisfy 0 <= d_i < b.

Base 2 uses 0,1; base 8 uses 0 to 7; base 10 uses 0 to 9. Base 16 uses 0 to 9 and A,B,C,D,E,F, where A through F mean decimal 10 through 15.

For example, (2A7.4)_16 means:

2 x 16^2 + 10 x 16^1 + 7 x 16^0 + 4 x 16^-1

= 512 + 160 + 7 + 0.25 = 679.25_10.

2A7.4 is a representation; 679.25 is the same value in decimal. Check validity first. (57)_6 and (19)_9 are invalid, while (00101.100)_2 = (101.1)_2 because outer zeros do not change value. When decimal is always one side of the conversion, Decimal Conversion Explained: Binary, Octal and Hexadecimal Worked Examples runs that narrower drill in full; here decimal is the bridge, not the destination.

Convert base 2 and base 5 numerals to decimal by expanding powers

Keep zero-coefficient places visible so the exponents do not shift:

(101101.011)_2

= 1 x 2^5 + 0 x 2^4 + 1 x 2^3 + 1 x 2^2 + 0 x 2^1 + 1 x 2^0 + 0 x 2^-1 + 1 x 2^-2 + 1 x 2^-3

= 32 + 8 + 4 + 1 + 0.25 + 0.125 = 45.375_10.

(324.13)_5 = 3 x 5^2 + 2 x 5^1 + 4 x 5^0 + 1 x 5^-1 + 3 x 5^-2

= 75 + 10 + 4 + 0.2 + 0.12 = 89.32_10.

Horner's rule checks the integer part without changing the definition: ((3 x 5) + 2) x 5 + 4 = 89. For a mixed numeral, mark the radix point, put exponent 0 immediately left, move outward, substitute letters, then add. Number systems and base conversions: binary, octal and hexadecimal explained sets these numerals beside complements, signed representation and BCD.

Place-value table for (2A7.4) in base 16, with contributions 512, 160, 7 and 0.25 adding to 679.25 in decimal.

Convert a decimal integer to base 6 or base 16 by repeated division

Divide 347_10 repeatedly by 6:

347 = 6 x 57 + 5

57 = 6 x 9 + 3

9 = 6 x 1 + 3

1 = 6 x 0 + 1

Read upward: 347_10 = (1335)_6, not (5331)_6. The first remainder is the coefficient of 6^0, the next of 6^1, and so on. Check: 1 x 6^3 + 3 x 6^2 + 3 x 6 + 5 = 216 + 108 + 18 + 5 = 347.

For hexadecimal, 756 = 16 x 47 + 4, 47 = 16 x 2 + 15, and 2 = 16 x 0 + 2. Replace 15 with F and read upward: (2F4)_16. Check: 2 x 256 + 15 x 16 + 4 = 756. The edge case 0_10 is 0, not an empty remainder list.

Convert decimal fractions into base 2 and base 6 by repeated multiplication

For 45.40625_10, the integer part is 101101_2. Multiply the fraction by 2 and read integer digits top to bottom:

  • 0.40625 x 2 = 0.8125, digit 0

  • 0.8125 x 2 = 1.625, digit 1

  • 0.625 x 2 = 1.25, digit 1

  • 0.25 x 2 = 0.5, digit 0

  • 0.5 x 2 = 1.0, digit 1

Therefore 45.40625_10 = (101101.01101)_2. Check the fraction: 1/4 + 1/8 + 1/32 = 0.40625. Division remainders go bottom to top; multiplication digits go top to bottom.

The loop does not care whether the target is a power of two. Multiplying 0.40625 by 6 gives 2.4375, 2.625, 3.75, 4.5, 3.0, so the digits are 2, 2, 3, 4, 3 and 0.40625_10 = (0.22343)_6. Paired with 347_10 = (1335)_6, that gives 347.40625_10 = (1335.22343)_6. Reverse-check the fraction: 2/6 + 2/36 + 3/216 + 4/1296 + 3/7776 = 3159/7776 = 0.40625.

Some fractions repeat. For 0.1_10, multiplication produces states 0.2, 0.4, 0.8, 0.6, 0.2... and digits (0.000110011...)_2; any finite cutoff is approximate. In lowest terms, p/q terminates in base b only if every prime factor of q divides b. That is why 0.40625 = 13/32 terminates in binary and in base 6, since 32 carries only the prime factor 2, which divides both, while 0.1 = 1/10 retains factor 5. At a digit limit, label the result truncated or rounded.

Use bit grouping only for powers of two

Group outward from the radix point. For (110101101.101011)_2, groups of three give 110 101 101 . 101 011, hence (655.53)_8. Groups of four, padded only at the outer edges, give 0001 1010 1101 . 1010 1100, hence (1AD.AC)_16.

Check the value: (655)_8 = 6 x 64 + 5 x 8 + 5 = 429, and (1AD)_16 = 256 + 160 + 13 = 429. Also, (.53)_8 = 5/8 + 3/64 = 0.671875, while (.AC)_16 = 10/16 + 12/256 = 0.671875.

For octal to hexadecimal, (725.34)_8 becomes 111 010 101 . 011 100_2. Regrouping gives 0001 1101 0101 . 0111 0000_2 = (1D5.70)_16, normally (1D5.7)_16. Digitwise substitution works only through shared power-of-two groups. It cannot convert decimal to octal directly. For addition and subtraction carried out directly in hexadecimal and octal, Binary, Octal and Hexadecimal: Worked Conversions, Arithmetic and GATE Exam Traps works those out.

Convert unrelated bases through a checked bridge

(2341)_5 = 2 x 5^3 + 3 x 5^2 + 4 x 5 + 1 = 250 + 75 + 20 + 1 = 346_10.

Now divide by 7: 346 = 7 x 49 + 3, 49 = 7 x 7 + 0, 7 = 7 x 1 + 0, and 1 = 7 x 0 + 1. Reading upward gives (1003)_7. Check: 1 x 7^3 + 0 x 7^2 + 0 x 7 + 3 = 343 + 3 = 346.

Unknown bases use the same definition. If (123)_b = 38_10, then b^2 + 2b + 3 = 38, so (b + 7)(b - 5) = 0. Reject b = -7; accept b = 5, which also satisfies b > 3, making every digit legal.

Three-panel bridge taking (2341) in base 5 to 346 in decimal, then to (1003) in base 7, with the check 343 + 3 = 346.

Base-conversion traps and rapid self-checks

Seven moves recur: evaluate a numeral, convert an integer, convert a fraction, reject an illegal digit, solve for an unknown base, compare numerals written in different bases, and count the digits a result needs. The failures that spoil them cluster into a short list.

Mistake

Exact failure

Repair

Reading 5,3,3,1 forward

Writes (5331)_6

Read upward to get (1335)_6

Accepting (57)_6

Digit 7 does not exist in base 6

Require every digit below the radix

Grouping from outer ends

Misaligns 110101101.101011_2

Group outward from the radix point

Padding inside a group

Changes place values

Pad only at outer edges

Substituting digits from base 5 to base 7

Assumes a group correspondence only powers of two have

Bridge through decimal, then divide by 7

Accepting b = -7 from (b + 7)(b - 5) = 0

A radix below 2 has no positional meaning

Keep only integer roots of at least 2, then check every digit against them

Treating 0.00011_2 as exact 0.1_10

Drops the repeating tail

Use an ellipsis or state precision

Each of these should take under a minute:

  1. (3B.8)_16 = 3 x 16 + 11 + 8/16 = 59.5_10.

  2. (144)_5 = 25 + 20 + 4 = 49_10.

  3. 250_10 = (505)_7: 250 = 7 x 35 + 5, 35 = 7 x 5 + 0, 5 = 7 x 0 + 5.

  4. (101011.01)_2 = (2B.4)_16.

  5. A numeral containing digit 6 requires b >= 7.

  6. (0.4)_8 = 4/8 = 0.5 while (0.4)_16 = 4/16 = 0.25, so identical digits in a larger base give a smaller fraction.

  7. (1335)_6 needs four digits because 6^3 = 216 <= 347 < 1296 = 6^4.

For more practice on these conversions, use Number System MCQs: 12 Solved for explained practice and the GATE Test Series for timed practice.

Base conversion in six rules, and what to practise next

  • Validate every digit.

  • To reach decimal, expand powers of the source base.

  • To leave decimal, divide integers and multiply fractions by the target base.

  • Read division remainders upward and multiplication digits downward.

  • Group bits only for power-of-two bases.

  • Reverse-convert the final answer.

Your three checkpoints are (2A7.4)_16 = 679.25_10, 347.40625_10 = (1335.22343)_6, and (2341)_5 = 346_10 = (1003)_7. Reproduce each, then explain why 0.1_10 needs an ellipsis or stated precision in binary.

Now redo the base-5 to base-7 bridge and work the seven rapid checks from a blank page. GATE CS Exam Preparation collects the wider digital-logic and number-system topics these conversions feed into.