Binary, Decimal, Hex and Octal — Number Systems Explained Simply
Why do computers use binary? What is hexadecimal? This beginner-friendly guide explains the four main number systems used in computing and how to convert between them.
Why Are There Different Number Systems?
Humans naturally use the decimal (base-10) number system — we have 10 fingers, so we count in groups of 10. Computers, however, are built from transistors that have two states: on or off, 1 or 0. This makes binary (base-2) the natural language of computing hardware. Other number systems like hexadecimal (base-16) and octal (base-8) exist because they're more practical for representing binary data in a human-readable way.
The Four Main Number Systems
Decimal (Base-10)
The number system we use every day. Uses digits 0–9. Each position represents a power of 10.
Example: 245 = (2 × 100) + (4 × 10) + (5 × 1)
Binary (Base-2)
Used by computers at the hardware level. Uses only digits 0 and 1. Each position represents a power of 2.
Example: 1010 in binary = (1 × 8) + (0 × 4) + (1 × 2) + (0 × 1) = 10 in decimal
Octal (Base-8)
Uses digits 0–7. Each octal digit represents exactly 3 binary digits, making it useful in some programming contexts. Less common today than it used to be.
Example: 17 in octal = (1 × 8) + (7 × 1) = 15 in decimal
Hexadecimal (Base-16)
Uses digits 0–9 and letters A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit represents exactly 4 binary digits, making it very compact for representing binary data. Widely used in programming, colour codes, memory addresses, and error codes.
Example: FF in hex = (15 × 16) + (15 × 1) = 255 in decimal
Conversion Quick Reference
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
Where You See These Number Systems in Real Life
- Hex colour codes: Web colours like #FF5733 are written in hexadecimal. FF = 255 red, 57 = 87 green, 33 = 51 blue.
- IP addresses: IPv6 addresses use hexadecimal notation.
- File permissions in Linux: chmod 755 uses octal notation.
- Memory addresses: Debuggers and low-level programming tools display memory locations in hexadecimal.
- Error codes: Windows error codes like 0x80070002 are in hexadecimal.
Convert Number Bases Instantly
Use our free number base converter to instantly convert between binary, decimal, hexadecimal and octal. Just enter your number and select the source and target bases.