Menu

Denary to Binary Conversion

Denary to Binary: Place Value Method

To turn a denary number into unsigned 8-bit binary, you can use the place-value method: compare the number with each binary place value from largest to smallest, deciding one bit at a time.

Write out the eight place values

Write 128, 64, 32, 16, 8, 4, 2 and 1 in a row. Each value is double the one on its right, and between them they cover every whole number from 0 to 255.

Place value1286432168421
Bit01011001
Amount left89252591110

Work from left to right

At each place, ask whether that place value fits into the amount you still have left.

  • If the place value is larger than the amount left, write 0 — nothing is taken away.
  • If it fits, write 1 and subtract that place value from the amount left.

Take 89. 128 is too big, so write 0. 64 fits, so write 1 and 89 − 64 = 25. 32 is too big: 0. 16 fits: 1, leaving 9. 8 fits: 1, leaving 1. Then 4 and 2 are too big: 0 and 0. Finally 1 fits: 1, leaving 0. Reading across gives 01011001.

The subtraction is what keeps the running total right. Writing a 1 without subtracting would set extra bits and push the total past the number you started with.

Once the amount left reaches zero, fill every remaining place to the right with 0 so that the answer is exactly eight bits, even when those bits add nothing.

The ends of the range

Eight bits give 256 different patterns, so an unsigned 8-bit number holds the values 0 to 255. Zero uses every bit at 0, so it is 00000000. 255 needs every place value: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, so all eight bits are 1 and it is 11111111. A denary number above 255 needs a ninth bit, so it cannot be stored in an unsigned 8-bit number at all.

Practise this