What Is a Number Base?
A number base (or radix) determines how many unique digits are used to represent numbers. Decimal (base 10) uses digits 0-9. Binary (base 2) uses only 0 and 1. Hexadecimal (base 16) uses 0-9 and A-F. The value of each digit depends on its position — just like in decimal, where "42" means 4×10 + 2×1.
Developers encounter multiple number bases constantly: binary for bitwise operations, hex for colours and memory addresses, octal for Unix file permissions, and decimal for everything else.
Binary (Base 2)
Binary is the language of hardware. Every CPU instruction, memory address, and network packet is ultimately a sequence of 0s and 1s. In JavaScript, you write binary literals with the 0b prefix: 0b1010 equals 10 in decimal.
Binary is essential for bitwise operations: AND (&), OR (|), XOR (^), and bit shifting (<<, >>). These operations are used in feature flags, permission systems, and low-level protocols.
Conversion: each binary digit represents a power of 2. 1010 = 1×8 + 0×4 + 1×2 + 0×1 = 10.
Octal (Base 8)
Octal uses digits 0-7. Its main use in modern development is Unix file permissions. The permission 755 means owner can read/write/execute (7 = 4+2+1), group can read/execute (5 = 4+1), and others can read/execute (5 = 4+1).
In JavaScript, octal literals use the 0o prefix: 0o755. The older 0755 syntax (without the "o") is forbidden in strict mode because it caused subtle bugs — 0777 looks like decimal but is octal.
Hexadecimal (Base 16)
Hex uses digits 0-9 and letters A-F (case-insensitive). Each hex digit represents exactly 4 binary digits (bits), which makes hex a compact way to write binary values. One byte (8 bits) is exactly two hex digits: FF = 11111111 = 255.
Common uses: CSS colours (#FF6B4A), memory addresses (0x7FFF5FBFF8A0), Unicode code points (U+1F600), cryptographic hashes, and UUIDs.
In JavaScript: 0xFF equals 255. Use Number.toString(16) to convert to hex and parseInt("FF", 16) to parse hex strings.
Quick Conversion Table
0= 0000 = 0x05= 0101 = 0x510= 1010 = 0xA15= 1111 = 0xF255= 11111111 = 0xFF256= 100000000 = 0x100
Why Developers Need Multiple Bases
You do not "choose" a number base like you choose a framework — different contexts demand different bases. Hex is compact and maps cleanly to bytes. Binary makes bit-level operations visible. Octal is the standard for file permissions. Decimal is for human-facing values. The Number Base Converter tool lets you convert between all four instantly.