Boneyard Tools

How decimal to binary conversion works

The place-value idea behind base 2, the divide-by-two remainder method worked step by step, and why computers store every number in binary.

Place value in base 2

Decimal counts in powers of ten, where each column is worth ten times the one to its right. Binary follows the same pattern but with a base of two, so the columns are worth 1, 2, 4, 8, 16 and onward, each double the last. A binary number is just a sum of the column values wherever a 1 appears. Reading 1101 from the right gives 1 plus 0 plus 4 plus 8, which totals 13. Because only two symbols exist, every position answers a single yes or no question: is this power of two included or not.

The divide-by-two remainder method

To turn a decimal number into binary by hand, divide it by 2 and note the remainder, which is always 0 or 1. Then divide the quotient by 2 again and note the next remainder, repeating until the quotient reaches 0. The remainders come out in reverse order, so the last one you find is the leftmost binary digit. This works because each division peels off the lowest bit of the number, exactly mirroring how the place values are built up. The method is simple enough to do on paper yet is precisely what the converter automates.

A worked example with 156

Start with 156. Dividing by 2 gives 78 remainder 0, then 39 remainder 0, then 19 remainder 1, then 9 remainder 1, then 4 remainder 1, then 2 remainder 0, then 1 remainder 0, then 0 remainder 1. Collecting those remainders from last to first spells 10011100. You can check the answer by adding the column values for each 1: 128 plus 16 plus 8 plus 4 equals 156. This tool runs the same loop internally, which is why the result appears the instant you finish typing.

Why computers use binary

Digital circuits are built from switches that are either on or off, so representing numbers with just two symbols maps perfectly onto the hardware. A single wire carrying high or low voltage stores one bit, and a group of bits stores larger values. This is why memory sizes, addresses and color codes are all natural in base 2, and why a byte holds exactly eight bits with a range of 0 to 255. Converting between decimal and binary is a routine step whenever a human readable number has to line up with the way a machine stores it.

Frequently asked questions

How do I check a binary result by hand?

Write the power of two above each digit, starting at 1 on the far right and doubling to the left. Add up the powers that sit above a 1, and the total should match your original decimal number.

Why do the remainders come out backwards?

Each division extracts the least significant bit first, so the first remainder you record is the rightmost digit. Reading the remainders from last to first therefore restores the correct left-to-right order.