What Are Number Bases?
Every number system you use daily is a positional system -- the value of each digit depends on its position within the number. The system most people learn first is base-10 (decimal), which uses ten symbols (0 through 9). Each position represents a successive power of ten: the rightmost digit is multiplied by 100, the next by 101, and so on.
The same principle applies to every other base. Base-2 (binary) has two symbols (0 and 1) and each position is a power of two. Base-8 (octal) uses digits 0--7 with powers of eight, while base-16 (hexadecimal) extends the digit set with the letters A--F to represent values 10 through 15. Despite looking different on the page, they all encode the same underlying quantities -- just in different radixes.
Why Developers Use Different Bases
Different bases exist because they map naturally to different computing concepts. Choosing the right base makes data easier to read, debug, and reason about.
- Binary (base-2) mirrors how hardware actually works. Every transistor is either on or off, so binary is the native language of CPUs, memory, and network protocols. Bit masks, flags, and bitwise operations are all expressed in binary.
- Octal (base-8) groups three binary digits into a single symbol, which is why Unix file permissions use it. A permission like
755is far more readable than its binary equivalent111 101 101. - Hexadecimal (base-16) groups four binary digits per symbol, making it the standard shorthand for memory addresses, color codes (
#FF5733), MAC addresses, and raw byte values. Two hex digits represent exactly one byte, which keeps output compact and aligned.
Knowing when to reach for each base is a core developer skill. This converter lets you switch between all four instantly so you can verify values, debug protocol dumps, or translate between documentation formats without mental arithmetic.
Converting Between Bases
The classic pen-and-paper technique is the divide-and-remainder method. To convert a decimal number to another base, repeatedly divide by the target base and record each remainder. The remainders, read in reverse order, form the result. For example, converting decimal 156 to hex: 156 / 16 = 9 remainder C (12), then 9 / 16 = 0 remainder 9, giving 9C.
There is a useful shortcut when converting between bases that are powers of two. Because 8 = 23 and 16 = 24, you can group binary digits directly. To go from binary to octal, split the binary string into groups of three bits from the right and convert each group independently. For hex, group into four bits instead. This grouping trick is why hex and octal exist in the first place -- they are compact notations for binary data.
Going the other direction -- from hex or octal back to binary -- simply expand each digit into its 4-bit or 3-bit binary equivalent. The converter on this page performs all of these steps automatically, but understanding the underlying method helps when you encounter raw values in logs, datasheets, or debugger output.
Related Tools
If you work with a specific pair of bases frequently, these dedicated converters offer a streamlined interface:
- Hex to Decimal Converter -- quickly translate hexadecimal values to their decimal equivalents and back.
- Binary to Decimal Converter -- focused conversion between binary and decimal for bit-level work.
- Chmod Calculator -- see octal permission values in action, with an interactive breakdown of read, write, and execute bits.