Every number you read is written in some base, and the base is a choice, not a property of the number itself. The quantity we call “two hundred fifty five” can be written 255, or 0xFF, or 11111111, or 0o377. Same amount, four notations. Once you see that a base is just a counting rule, the conversions stop feeling like magic and start feeling like arithmetic. This guide walks through the four bases you will actually meet in code and how to move between them by hand.
What a base actually means
Positional notation means each digit’s value depends on its position. In base 10 the number 253 is not three digits sitting side by side; it is 2 times 100, plus 5 times 10, plus 3 times 1. Those place values are powers of the base: 10 to the 2, 10 to the 1, 10 to the 0. The base tells you two things at once: how many distinct digit symbols exist (10 of them, 0 through 9) and what each place is worth (a power of 10).
Change the base and only those two facts change. The mechanism is identical. Base 2 uses two symbols and place values that are powers of 2. Base 16 uses sixteen symbols and powers of 16. That is the whole idea, and the rest is bookkeeping.
Decimal, base 10
Decimal is the base you grew up with, so it is the useful anchor. Digits run 0 to 9, and each place to the left is worth ten times the place to its right: ones, tens, hundreds, thousands. There is nothing special about ten except that humans have ten fingers. Computers do not, which is why the machine prefers a different base entirely.
Binary, base 2, and bits and bytes
Binary has exactly two digits, 0 and 1, because a physical circuit is cleanly either off or on. A single binary digit is a bit. Place values are powers of 2: 1, 2, 4, 8, 16, 32, 64, 128, and so on. To read a binary number, add up the place values wherever a 1 appears. The pattern 11111111 is 128 plus 64 plus 32 plus 16 plus 8 plus 4 plus 2 plus 1, which equals 255.
Bits are grouped into bytes. A byte is 8 bits, and 8 bits hold 2 to the 8th, or 256, distinct values: 0 through 255. That 255 ceiling is why so many limits in computing stop there. If you want to turn byte values back into readable characters, the binary to text tool decodes them, and the ASCII table shows which number maps to which character.
Hexadecimal, base 16, and the nibble
Binary is correct but hard to read; long runs of ones and zeros blur together. Hexadecimal fixes this. Base 16 needs sixteen symbols, so it borrows the letters A through F for the values 10 through 15: 0 1 2 3 4 5 6 7 8 9 A B C D E F. Hex numbers are usually written with a 0x prefix, as in 0xFF.
The reason hex is everywhere is that it lines up perfectly with binary. Four bits hold 2 to the 4th, or 16, values, which is exactly one hex digit. Those four bits are called a nibble (half a byte, and yes, the pun is deliberate). So one hex digit is one nibble, and one byte is exactly two hex digits. To convert, split the binary into groups of four from the right and translate each group: 1111 is F, so 11111111 is FF, so 0xFF is 255. No arithmetic across the whole number, just per-nibble lookup.
Octal, base 8
Octal uses eight digits, 0 through 7, with place values that are powers of 8. It groups binary into chunks of three bits instead of four. It shows up mostly in older systems and in Unix file permissions, where 0o755 encodes read, write, and execute flags. It is less common than hex today, but the same grouping trick applies.
Converting by hand
To go from decimal to another base, divide repeatedly by the base and collect the remainders from bottom to top. For 255 into binary: 255 divided by 2 is 127 remainder 1, and continuing that division yields 11111111. To go from any base back to decimal, multiply each digit by its place value and sum. When you would rather not do it by hand, the number base converter handles all four bases at once and shows the result live.
Where each base shows up
You meet hex in CSS colors, where #FF0000 is two hex digits each for red, green, and blue. You meet it in memory addresses and hex dumps, because two tidy characters per byte beat eight bits. You meet binary wherever individual bits carry meaning: flags packed into one integer, bitmasks that toggle options with AND and OR, and low level protocols. Decimal stays the language for humans and counts, and octal lingers in permission strings. Pick the base that makes the current job legible; the underlying number never changes.