QUICKUNITS
Blog

Binary, Octal, Decimal and Hexadecimal — Number Bases Explained

5 min read

Every number can be expressed in different bases. Computers use binary. Programmers use hexadecimal. Understanding why makes programming, networking and computer science considerably easier.

Our everyday number system is base 10 (decimal) — we use ten digits (0-9) and each position in a number represents a power of ten. The number 347 means 3×100 + 4×10 + 7×1. This system is natural for humans (we have ten fingers) but arbitrary for computers.

Binary (base 2) uses only two digits — 0 and 1. This maps directly to the on/off states of transistors in digital circuits. The binary number 1011 means 1×8 + 0×4 + 1×2 + 1×1 = 11 in decimal. All computer processing ultimately happens in binary, which is why understanding it is foundational to computer science.

Hexadecimal (base 16) uses sixteen digits: 0-9 and then A-F (where A=10, B=11, C=12, D=13, E=14, F=15). Hexadecimal is popular in programming because each hex digit represents exactly four binary digits (a nibble), making it a compact way to represent binary data. The hex number FF = 1111 1111 in binary = 255 in decimal. Memory addresses, colour codes (#FF5733) and binary data are all commonly written in hexadecimal.

Octal (base 8) uses digits 0-7 and was historically used in computing because early computers had word sizes that were multiples of 3 bits, making octal a convenient shorthand for binary. It is less common today but still appears in Unix file permissions (chmod 755) where each digit represents three binary permission bits.