WikiPlus

How to Convert Decimal to Binary by Hand

Converting decimal numbers to binary by hand is a foundational computer science skill that appears in technical interviews, university exams, and everyday development tasks involving bitwise operations. Even when you have a calculator or online tool available, understanding the underlying process deepens your intuition about binary numbers, powers of 2, and how data is stored. This guide teaches two methods with worked examples and shows you how to verify your work.

Method 1: Repeated Division by 2

The repeated division method is the standard algorithm for converting any positive integer from decimal to binary. It is systematic, easy to remember, and works for any integer no matter how large. The algorithm: 1. Divide the decimal number by 2. 2. Record the quotient and the remainder (which is always 0 or 1). 3. Divide the quotient by 2 again. 4. Repeat until the quotient is 0. 5. Read the remainders from bottom to top — this is the binary equivalent. Worked example: Convert 45 to binary. 45 ÷ 2 = 22 remainder 1 22 ÷ 2 = 11 remainder 0 11 ÷ 2 = 5 remainder 1 5 ÷ 2 = 2 remainder 1 2 ÷ 2 = 1 remainder 0 1 ÷ 2 = 0 remainder 1 Reading remainders from bottom to top: 101101. Verification (binary to decimal): 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1 = 32 + 8 + 4 + 1 = 45. Correct. The key insight: each remainder represents one bit of the binary number, starting from the least significant bit (rightmost). Reading bottom to top gives you the most significant bit first, which is how we conventionally write binary numbers. This method works for any positive integer. For very large numbers, the number of division steps equals the number of bits in the result, so a 32-bit number requires up to 32 divisions.

Method 2: Subtraction of Powers of 2

The subtraction method works by finding the largest power of 2 that fits in the number, placing a 1 in that bit position, and repeating with the remainder. This method is more intuitive for people who think visually about binary numbers. Powers of 2 to memorize: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. The algorithm: 1. Find the largest power of 2 that is less than or equal to your number. 2. Place a 1 in that bit position. 3. Subtract that power of 2 from your number. 4. Repeat with the remainder, using the next lower powers of 2. 5. Place 0 in any bit position whose power of 2 was not used. Worked example: Convert 45 to binary. Largest power of 2 ≤ 45 is 32 (2^5). 45 - 32 = 13. Bit 5: 1. Largest power of 2 ≤ 13 is 8 (2^3). 13 - 8 = 5. Bit 3: 1. Largest power of 2 ≤ 5 is 4 (2^2). 5 - 4 = 1. Bit 2: 1. Largest power of 2 ≤ 1 is 1 (2^0). 1 - 1 = 0. Bit 0: 1. Bit positions not used: bits 4 and 1 → 0. Building the binary number (bit positions 5,4,3,2,1,0): 1, 0, 1, 1, 0, 1 = 101101. Same result as Method 1. Both methods always produce the same answer; choose whichever feels more natural to you. The subtraction method is often faster for mental calculation when the number is close to a power of 2. For example, 127 = 128 - 1 = 01111111 (seven 1s) and 129 = 128 + 1 = 10000001 are immediately obvious from the subtraction perspective.

Converting Larger Numbers: A Systematic Approach

For numbers in the hundreds or thousands, applying the repeated division method carefully and systematically prevents errors. Worked example: Convert 200 to binary. 200 ÷ 2 = 100 R0 100 ÷ 2 = 50 R0 50 ÷ 2 = 25 R0 25 ÷ 2 = 12 R1 12 ÷ 2 = 6 R0 6 ÷ 2 = 3 R0 3 ÷ 2 = 1 R1 1 ÷ 2 = 0 R1 Reading remainders bottom to top: 11001000. Verify: 128 + 64 + 8 = 200. Correct. Alternatively, using the subtraction method: 200 - 128 = 72 (bit 7 = 1), 72 - 64 = 8 (bit 6 = 1), 8 - 8 = 0 (bit 3 = 1). Bits 7,6,3 are set, rest are 0: 11001000. Converted example: Convert 1000 to binary. Using the subtraction method, the largest power of 2 ≤ 1000 is 512. 1000-512=488. 488-256=232. 232-128=104. 104-64=40. 40-32=8. 8-8=0. Bits set: 9,8,7,6,5,3. Binary: 1111101000. Verify: 512+256+128+64+32+8 = 1000. Correct. For daily development work, you will rarely need to convert numbers larger than about 255 (8 bits) by hand. For larger values, our Number Base Converter is faster and error-free. The value of learning manual conversion is developing the intuition about bit positions and powers of 2, not speed.

Common Mistakes and How to Avoid Them

When converting decimal to binary by hand, certain mistakes occur repeatedly. Knowing them in advance helps you avoid or catch them. Mistake 1: Reading remainders in the wrong order. In the repeated division method, you must read remainders from last to first (bottom to top). Reading them top to bottom gives you a different number — the bits in reversed order. Fix: Write a small arrow or note 'read upward' next to your work. Or use the subtraction method, which builds the result in the correct order from the most significant bit down. Mistake 2: Forgetting to include zero bits. If your conversion has gaps between powers of 2, you must explicitly include the 0 bits in those positions. For example, if bits 7, 5, and 0 are set, the result is 10100001 (8 bits), not 111 (3 bits). Fix: Always count from the highest bit position down to position 0, writing a 0 for any position you did not use. Mistake 3: Using the wrong number of bits. An 8-bit representation of 5 is 00000101, not 101. The number of leading zeros matters when working with fixed-width binary (like a byte). Fix: Determine the required bit width before converting. For byte-aligned work, pad with leading zeros to the nearest multiple of 4 or 8 bits. Mistake 4: Arithmetic errors in the division steps. A single arithmetic error propagates through all subsequent steps. Fix: Verify your answer by converting back: sum the bit values and check you get the original decimal number. This catches all arithmetic errors. Also consider using our Number Base Converter to check your work after manual conversion.

Frequently Asked Questions

How do I convert a decimal fraction (like 0.5) to binary?
For fractional parts, multiply by 2 instead of dividing. Record the integer part (0 or 1) at each step and continue with the fractional part. Example: 0.5 × 2 = 1.0. Integer part: 1. Fractional part: 0.0 (done). So 0.5 in decimal = 0.1 in binary. For 0.625: 0.625×2=1.25 (1), 0.25×2=0.5 (0), 0.5×2=1.0 (1). Result: 0.101. Verify: 0.5 + 0.125 = 0.625.
What is the binary representation of negative numbers?
Computers use two's complement to represent negative numbers. To find the two's complement of a number: invert all bits (flip 0s to 1s and vice versa), then add 1. Example: -5 in 8-bit two's complement: positive 5 is 00000101. Invert: 11111010. Add 1: 11111011. So -5 is 11111011 in 8-bit two's complement. This system allows the CPU to add negative and positive numbers using the same addition circuit.
Is there a quick way to check if my decimal-to-binary conversion is correct?
Yes — convert back. Take your binary result and add up the place values for all the 1 bits. If you get the original decimal number, the conversion is correct. For example, if you converted 42 to 101010, check: 32+8+2=42. Correct. This self-check catches virtually all errors and only takes a few seconds once you know the powers of 2.