Why 255, FF, and 11111111 are the same number — and why programmers keep talking in powers of two.
The number 255, the text FF, and the digits 11111111 all describe the same quantity. They look completely different because each is written in a different base — decimal, hexadecimal, and binary. If you have ever wondered why colours in CSS look like #FF8800, why a file permission is 755, or why programmers keep talking in powers of two, this is the article that makes it click.
A base is simply how many distinct digits a number system uses, and therefore the value of each position. We use base 10 (decimal) because we have ten fingers: digits 0–9, and each position is worth ten times the one to its right — ones, tens, hundreds, thousands. Change the base and you change two things: the set of available digits, and the multiplier per position.
A computer is built from switches that are either off or on — 0 or 1. That is binary at the physical level. Every number, letter, image, and instruction is ultimately a pattern of those two states. Eight of these bits make a byte, which can represent 256 different values (0 to 255). That “256” is why so many limits in computing are 255 or 256: it is the natural ceiling of one byte.
Binary is correct but unreadable — 11111111 is hard to scan and easy to miscount. Hexadecimal is a compact shorthand for it. Because 16 is exactly 2 to the fourth power, every group of four binary digits maps to exactly one hex digit. So one byte (eight bits) is always exactly two hex digits. 11111111 becomes FF; 10000000 becomes 80. This tidy 4-bits-per-digit relationship is why hex shows up everywhere bytes are involved: colour codes, memory addresses, and byte dumps.
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 5 | 0101 | 5 |
| 10 | 1010 | A |
| 15 | 1111 | F |
| 255 | 11111111 | FF |
To turn a decimal number into binary, repeatedly divide by 2 and record the remainders from bottom to top. For 13: 13÷2 = 6 r1, 6÷2 = 3 r0, 3÷2 = 1 r1, 1÷2 = 0 r1 — read upward: 1101. To go from binary back to decimal, add up the position values where there is a 1: 1101 is 8 + 4 + 0 + 1 = 13. Hex works the same way with multipliers of 16. You rarely need to do this by hand, but doing it once demystifies what a converter is actually computing.
#FF8800 is three bytes — red, green, blue — each written as two hex digits, so each channel runs 00 to FF (0 to 255).chmod 755 is octal (base 8); each digit is three permission bits for owner, group, and others.0x.Because the same digits can be valid in several bases (101 is a number in binary, decimal, and hex), notation uses prefixes to disambiguate: 0b101 for binary, 0x101 for hex, and plain 101 for decimal. When you see 0x in code, that is your cue the value is hexadecimal — read each digit as 0–15.
There is only ever one quantity; the base is just the costume it wears. Binary reflects the hardware, hexadecimal is a human-friendly shorthand for binary, and decimal is what we count in. Knowing how the positions multiply lets you read a colour code, a permission flag, or a byte dump without guessing — and when you would rather not do the arithmetic, a converter turns any base into any other in one step.