Number bases: watch it solved step by step
Convert between decimal and binary, octal, hexadecimal or any base: repeated division for the whole part, repeated multiplication for the fraction. Level: KS3 / A-level. Type any problem of this kind and the Lab works it out and animates every move, with a plain-words explanation of why.
Worked example: convert 255 to binary
- The question. We write the decimal number 255 in binary (base 2). In base 2, each place is worth 2 times the place to its right, and only the digits 0, 1 are used. The whole part and the fractional part are converted in different ways.
- Whole part: divide by 2 again and again. To convert the whole part 255, divide by 2, write down the remainder, then divide the quotient by 2 again. Stop when the quotient reaches 0. The remainders, read from the bottom up, are the digits.
- 255 ÷ 2 = 127 remainder 1. 255 ÷ 2 = 127 with remainder 1. Carry on with the quotient 127.
- 127 ÷ 2 = 63 remainder 1. 127 ÷ 2 = 63 with remainder 1. Carry on with the quotient 63.
- 63 ÷ 2 = 31 remainder 1. 63 ÷ 2 = 31 with remainder 1. Carry on with the quotient 31.
- 31 ÷ 2 = 15 remainder 1. 31 ÷ 2 = 15 with remainder 1. Carry on with the quotient 15.
- 15 ÷ 2 = 7 remainder 1. 15 ÷ 2 = 7 with remainder 1. Carry on with the quotient 7.
- 7 ÷ 2 = 3 remainder 1. 7 ÷ 2 = 3 with remainder 1. Carry on with the quotient 3.
- 3 ÷ 2 = 1 remainder 1. 3 ÷ 2 = 1 with remainder 1. Carry on with the quotient 1.
- 1 ÷ 2 = 0 remainder 1. 1 ÷ 2 = 0 with remainder 1. The quotient is 0, so we stop.
- Read the remainders from the bottom up. The last remainder is the leftmost digit. Reading upwards gives 11111111.
- Put the two parts together. Whole part 11111111, then the point, then the fractional digits (none: it is a whole number). So 255 in base 2 is 11111111.
Answer: 11111111 in base 2
Practise number bases with problems the Lab marks for you.