Number systems are ways of representing values using a specific set of symbols called digits, defined by a base that determines the number of unique digits available. Most people mistake the base for the highest digit used, but the base is actually the total count of digits, meaning the highest digit is always base minus one.
Base Systems and Their Digits
The base, or radix, tells you how many symbols are used to represent numbers. Once you reach the limit of these symbols in a single column, you carry over to the next place value on the left. This positional notation means the value of a digit depends on its position relative to the decimal or radix point.
| System | Base | Digits/Symbols Used | Common Use |
|---|---|---|---|
| Binary | 2 | 0, 1 | Computing/Logic |
| Octal | 8 | 0, 1, 2, 3, 4, 5, 6, 7 | Unix Permissions |
| Decimal | 10 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 | Daily Counting |
| Hexadecimal | 16 | 0-9, A, B, C, D, E, F | Color Codes/Memory |
In Hexadecimal, letters are used because we need single symbols for values 10 through 15. A represents 10, B is 11, C is 12, D is 13, E is 14, and F is 15. If you see a number like 1A, it does not mean one and a letter; it means one group of 16 and ten units.
Decimal to Any Base Conversion
To convert a decimal number to another base, you use the repeated division method. You divide the decimal number by the target base and record the remainder. You then divide the quotient again by the base and repeat this process until the quotient becomes zero. The final answer is the sequence of remainders read from the last one found (the most significant digit) to the first one found (the least significant digit).
This method works because each division isolates the value of the current place column. For example, dividing by 2 isolates whether the number is even or odd, which determines the 2^0 position in binary. The subsequent divisions isolate the 2^1, 2^2, and higher positions.
Converting 25 to Binary (Base 2)
- Divide 25 by 2: Quotient = 12, Remainder = 1
- Divide 12 by 2: Quotient = 6, Remainder = 0
- Divide 6 by 2: Quotient = 3, Remainder = 0
- Divide 3 by 2: Quotient = 1, Remainder = 1
- Divide 1 by 2: Quotient = 0, Remainder = 1
Reading the remainders from bottom to top, 25 in decimal is 11001 in binary.
Any Base Back to Decimal
Converting from a non-decimal base back to decimal requires the expansion method. You multiply each digit by the base raised to the power of its position. The position is counted from right to left, starting at 0 for the digit immediately to the left of the radix point.
The formula is: (Digit * Base^Position) + (Digit * Base^Position-1) and so on. This process effectively reconstructs the total value by summing the weights of each column. If you are dealing with fractions (digits to the right of the point), the positions become negative: -1, -2, -3, etc.
Converting 1A3 from Hexadecimal (Base 16)
- Identify positions: 1 is at position 2, A is at position 1, 3 is at position 0.
- Convert symbols to values: 1 = 1, A = 10, 3 = 3.
- Calculate weights: (1 * 16^2) + (10 * 16^1) + (3 * 16^0).
- Solve the exponents: (1 * 256) + (10 * 16) + (3 * 1).
- Sum the totals: 256 + 160 + 3 = 419.
Therefore, 1A3 in hexadecimal is 419 in decimal.
Binary to Hexadecimal Shortcuts
You do not need to convert binary to decimal first to reach hexadecimal. Because 16 is a power of 2 (2^4 = 16), exactly four binary digits (bits) map to one hexadecimal digit. This grouping method is faster and reduces the chance of arithmetic errors during large conversions.
To perform this, split the binary string into groups of four, starting from the right. If the leftmost group has fewer than four bits, add leading zeros to fill the gap. Each 4-bit group is then converted to its corresponding hex symbol using a simple lookup.
| Binary | Hex | Binary | Hex |
|---|---|---|---|
| 0000 | 0 | 1000 | 8 |
| 0001 | 1 | 1001 | 9 |
| 0010 | 2 | 1010 | A |
| 0011 | 3 | 1011 | B |
| 0100 | 4 | 1100 | C |
| 0101 | 5 | 1101 | D |
| 0110 | 6 | 1110 | E |
| 0111 | 7 | 1111 | F |
Example: Convert 101101101 to Hex. Group from right: 0001 | 0110 | 1101. Using the table: 0001 = 1, 0110 = 6, 1101 = D. The result is 16D.
Binary to Octal Grouping
Similar to the hexadecimal shortcut, octal (base 8) can be reached by grouping binary digits. Since 8 is 2^3, you group the binary digits into sets of three instead of four. Again, start from the right and add leading zeros to the leftmost group if necessary.
For the binary number 101101101, group by threes: 101 | 101 | 101. Each group of 101 in binary equals 5 in decimal/octal. The result is 555 in octal. This symmetry between bases that are powers of each other is why binary, octal, and hexadecimal are used together in computing, while decimal is not.
Positional Errors and Radix Points
A common mistake is forgetting that the first position to the left of the point is always base^0, which equals 1. Some users accidentally start counting at base^1, which shifts the entire value of the number. Always verify that your rightmost whole number is multiplied by 1.
When handling numbers with a radix point (decimals), the powers decrease. The first digit to the right is base^-1 (1/base), the second is base^-2 (1/base^2). To convert a fractional binary number like 0.101 to decimal, calculate (1 * 2^-1) + (0 * 2^-2) + (1 * 2^-3), which is 0.5 + 0 + 0.125 = 0.625.
If you are converting a decimal fraction to another base, you use repeated multiplication instead of division. Multiply the fraction by the target base. The whole number part of the result becomes the digit. Take the remaining fractional part and multiply by the base again. Repeat until the fraction becomes zero or you reach the desired precision. Read these digits from top to bottom.
Converting 0.375 to Binary
- 0.375 * 2 = 0.75 (Integer part: 0)
- 0.75 * 2 = 1.5 (Integer part: 1)
- 0.5 * 2 = 1.0 (Integer part: 1)
Reading top to bottom, 0.375 in decimal is 0.011 in binary.