What a number system is
In a positional system the value of a digit depends on its place. The base tells how many times the weight of neighbouring places differs. Decimal has base 10, binary 2, octal 8 and hexadecimal 16. When the base exceeds 10 there are not enough ordinary digits, so letters are used: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15, and so on up to Z = 35.
Converting a number to decimal
Write the number as a sum: multiply each digit by the base raised to the place number. Places of the integer part are numbered from the right starting at 0, places of the fractional part from the left starting at −1.
- 1AF₁₆ = 1·16² + 10·16¹ + 15·16⁰ = 256 + 160 + 15 = 431.
- 101.101₂ = 1·2² + 0·2¹ + 1·2⁰ + 1·2⁻¹ + 0·2⁻² + 1·2⁻³ = 4 + 1 + 0.5 + 0.125 = 5.625.
Converting a decimal integer to another base
Divide the number by the target base with remainder, then divide the quotient the same way, until the quotient is zero. The remainders written from bottom to top give the number in the new base.
Example: 37 to binary. 37 : 2 = 18 (remainder 1), 18 : 2 = 9 (0), 9 : 2 = 4 (1), 4 : 2 = 2 (0), 2 : 2 = 1 (0), 1 : 2 = 0 (1). Reading the remainders from bottom to top: 37 = 100101₂.
Converting the fractional part
Multiply the fractional part by the base. The integer part of the product is the first digit after the point, and the fractional part of the product is multiplied again. Stop when the fractional part becomes zero or when you have enough digits.
Example: 0.625 to binary. 0.625 · 2 = 1.25 (digit 1), 0.25 · 2 = 0.5 (digit 0), 0.5 · 2 = 1.0 (digit 1). So 0.625 = 0.101₂.
A finite decimal fraction does not have to be finite in another base. For example 0.1 in binary is infinite: 0.0001100110011…₂. That is why tasks state how many digits to keep, and the calculator cuts the result and tells you the answer is approximate.
Quick conversion between 2, 8 and 16
The bases 8 and 16 are powers of two (8 = 2³, 16 = 2⁴), so one octal digit equals three binary digits (a triad) and one hex digit equals four (a tetrad).
- Binary to octal: split the number into groups of three from the point in both directions, pad with zeros if needed and replace each group with a digit. 1101011.01₂ = 001 101 011 . 010 = 153.2₈.
- Binary to hex: the same with groups of four. 110101111₂ = 0001 1010 1111 = 1AF₁₆.
- Back: replace each digit by its binary group.
- Octal to hex and back is easiest through binary.
Common mistakes
- Reading the remainders from top to bottom instead of bottom to top.
- Using a digit that does not exist in the base (2 in binary, 8 in octal).
- Numbering the places of the fractional part from 0 instead of −1.
- Forgetting to pad the outer groups with zeros in the triad and tetrad method: zeros go on the left of the integer part and on the right of the fractional part.
- Converting the fractional part by division instead of multiplication.