Number Systems Explained — Decimal, Binary, Octal, and Hex
Most people learn one number system — decimal — and never question it. But computing regularly uses four: decimal for human-readable output, binary for hardware representation, hexadecimal for compact binary representation, and octal for Unix file permissions. Understanding all four and how to convert between them is a practical skill that makes low-level debugging, security work, and systems programming significantly easier.
Convert between all number systems with our tools: Decimal Converter, Binary Converter, Octal Converter, and Hex Converter. Each tool converts to all other bases simultaneously.
The Four Number Systems Compared
Decimal (base-10): uses digits 0 through 9. Each position represents a power of 10. The system humans use because we have ten fingers. No special significance to computing hardware.
Binary (base-2): uses digits 0 and 1. Each position represents a power of 2. The natural system for digital hardware because transistors have two states: on and off.
Octal (base-8): uses digits 0 through 7. Each position represents a power of 8. Three binary digits map exactly to one octal digit, making it useful for representing groups of three bits — which is why Unix file permissions use octal.
Hexadecimal (base-16): uses digits 0 through 9 and letters A through F. Each position represents a power of 16. Four binary digits map exactly to one hex digit, making it the most compact human-readable format for binary data.
The same value — 255 — expressed in all four systems: Decimal: 255 Binary: 11111111 Octal: 377 Hexadecimal: FF
Notice that binary needs 8 digits, octal needs 3, hex needs 2, and decimal needs 3 for the same value. For 32-bit values, binary needs 32 characters, hex needs 8 characters. Hex wins for readability of binary data.
Why Octal Exists — Unix File Permissions
Octal appears most prominently in Unix and Linux file permissions. Every file and directory has three permission groups: owner, group, and others. Each group has three permission flags: read, write, and execute. Three flags in each group, three groups total — nine flags in total, represented as nine binary bits.
Grouping those nine bits into three groups of three and converting each group to one octal digit gives the familiar chmod value:
Read = binary 100 = octal 4 Write = binary 010 = octal 2 Execute = binary 001 = octal 1
Common permission combinations: rwx = 100 + 010 + 001 = 111 binary = 7 octal (all permissions) rw- = 100 + 010 + 000 = 110 binary = 6 octal (read and write, no execute) r-x = 100 + 000 + 001 = 101 binary = 5 octal (read and execute, no write) r-- = 100 + 000 + 000 = 100 binary = 4 octal (read only)
So chmod 755 means: owner gets 7 (rwx), group gets 5 (r-x), others get 5 (r-x). chmod 644 means: owner gets 6 (rw-), group gets 4 (r--), others gets 4 (r--). The three octal digits map directly to the three permission groups. Without understanding octal, these numbers are opaque. With it, you can read any chmod value instantly.
Fast Conversion Between Systems
Binary to Hex (The Four-Bit Trick)
Group binary digits in sets of 4 from the right and convert each group to one hex digit: 11111111 splits as 1111 and 1111 1111 = 15 = F, 1111 = 15 = F Result: FF
10110101 splits as 1011 and 0101 1011 = 11 = B, 0101 = 5 Result: B5
Binary to Octal (The Three-Bit Trick)
Group binary digits in sets of 3 from the right and convert each group to one octal digit: 11111111 splits as 011, 111, 111 (pad with leading zero if needed) 011 = 3, 111 = 7, 111 = 7 Result: 377
In Code (Python)
Python has built-in functions for all conversions: bin(255) gives 0b11111111 oct(255) gives 0o377 hex(255) gives 0xff int("ff", 16) converts hex string to decimal integer (255) int("377", 8) converts octal string to decimal integer (255) int("11111111", 2) converts binary string to decimal integer (255)
Convert between decimal, binary, octal and hex — all conversions in one tool
Decimal Converter → Octal Converter →Number Systems in Security and Networking
IPv4 addresses use decimal notation for readability, but are actually 32-bit binary numbers. The address 192.168.1.1 in binary is four bytes: 11000000.10101000.00000001.00000001. Subnet masks like 255.255.255.0 are meaningful in binary — it is 24 ones followed by 8 zeros, which is where CIDR notation /24 comes from. Check your IP address and network details with our IP Lookup tool.
IPv6 uses hexadecimal groups: 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Eight groups of four hex digits, each group representing 16 bits. The full 128-bit address would be unwieldy in decimal or binary — hex makes it manageable.
Cryptographic hashes output fixed-length binary values displayed as hex. An MD5 hash is 128 bits shown as 32 hex characters. A SHA-256 hash is 256 bits shown as 64 hex characters. Password hashing stores passwords using these algorithms. Our Password Strength Checker assesses password security, and our Password Generator creates cryptographically strong passwords.

