Four Number Systems You Need to Know
Humans count in decimal (base 10), most likely because we have 10 fingers. Computers count in binary (base 2) because electronic circuits have two states: on and off. Hexadecimal (base 16) exists as a compact way to represent binary values. Octal (base 8) survives in legacy systems and Unix file permissions. Together, these four systems cover virtually every number representation you will encounter in computing, programming, and digital engineering.
Convert between all four systems instantly with WritePadPro's Binary & Hex Converter — enter a number in any base and see the equivalent in all other bases.
| System | Base | Digits Used | Example (42) |
|---|---|---|---|
| Binary | 2 | 0, 1 | 101010 |
| Octal | 8 | 0-7 | 52 |
| Decimal | 10 | 0-9 | 42 |
| Hexadecimal | 16 | 0-9, A-F | 2A |
All four systems represent the same quantities — they differ only in their base (how many unique digits they use). Understanding conversion between them is fundamental to programming, networking, and digital design.
How Place Value Works Across Bases
Every number system works on the principle of place value — each digit's position represents a power of the base. Understanding this single concept makes conversion between any two bases straightforward.
Decimal (Base 10)
The number 4,279 in decimal means:
| Position | 10³ = 1000 | 10² = 100 | 10¹ = 10 | 10⁰ = 1 |
|---|---|---|---|---|
| Digit | 4 | 2 | 7 | 9 |
| Value | 4,000 | 200 | 70 | 9 |
Total: 4,000 + 200 + 70 + 9 = 4,279
Binary (Base 2)
The binary number 101010 means:
| Position | 2⁵ = 32 | 2⁴ = 16 | 2³ = 8 | 2² = 4 | 2¹ = 2 | 2⁰ = 1 |
|---|---|---|---|---|---|---|
| Digit | 1 | 0 | 1 | 0 | 1 | 0 |
| Value | 32 | 0 | 8 | 0 | 2 | 0 |
Total: 32 + 0 + 8 + 0 + 2 + 0 = 42
Hexadecimal (Base 16)
Hex uses 16 digits: 0-9 for values 0-9, then A=10, B=11, C=12, D=13, E=14, F=15. The hex number 2A means:
| Position | 16¹ = 16 | 16⁰ = 1 |
|---|---|---|
| Digit | 2 | A (=10) |
| Value | 32 | 10 |
Total: 32 + 10 = 42
Octal (Base 8)
Octal uses digits 0-7. The octal number 52 means:
| Position | 8¹ = 8 | 8⁰ = 1 |
|---|---|---|
| Digit | 5 | 2 |
| Value | 40 | 2 |
Total: 40 + 2 = 42
The pattern is identical across all bases — only the multipliers change. Once you understand place value in one base, you understand all of them. For converting numbers to English word form instead, see the Number to Words Converter.
How to Convert Between Systems
Decimal to Binary (Repeated Division)
Divide by 2 repeatedly. Record the remainder at each step. Read remainders bottom-to-top.
Example: Convert 42 to binary
| Step | Division | Quotient | Remainder |
|---|---|---|---|
| 1 | 42 ÷ 2 | 21 | 0 |
| 2 | 21 ÷ 2 | 10 | 1 |
| 3 | 10 ÷ 2 | 5 | 0 |
| 4 | 5 ÷ 2 | 2 | 1 |
| 5 | 2 ÷ 2 | 1 | 0 |
| 6 | 1 ÷ 2 | 0 | 1 |
Read remainders bottom-to-top: 101010 ✓
Binary to Decimal (Positional Addition)
Multiply each digit by its positional power of 2 and sum. 101010 = 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 42
Decimal to Hex (Repeated Division by 16)
Same method as binary, but divide by 16. Remainders 10-15 become A-F.
Example: Convert 255 to hex
- 255 ÷ 16 = 15 remainder 15 (F)
- 15 ÷ 16 = 0 remainder 15 (F)
Read bottom-to-top: FF ✓ (255 in decimal = FF in hex)
Binary to Hex (Group by 4)
This is the fastest conversion. Group binary digits into sets of 4 (from right). Convert each group to its hex digit.
Example: Convert 11111111 to hex
- 1111 = F (15)
- 1111 = F (15)
Result: FF ✓
This works because 2⁴ = 16 — each group of 4 binary digits maps exactly to one hex digit. This is why hexadecimal exists: it is a compact notation for binary.
Hex to Binary (Expand Each Digit)
Replace each hex digit with its 4-bit binary equivalent.
Example: Convert 3F7 to binary
- 3 = 0011
- F = 1111
- 7 = 0111
Result: 001111110111 (or 1111110111 dropping leading zeros)
Hexadecimal in CSS Colors
The most visible everyday use of hexadecimal for non-programmers is CSS color codes. Every color on the web can be represented as a 6-digit hex code.
How Hex Colors Work
A CSS hex color like #6366F1 encodes three values:
| Component | Hex Digits | Decimal Value | Meaning |
|---|---|---|---|
| Red | 63 | 99 | Red intensity (0-255) |
| Green | 66 | 102 | Green intensity (0-255) |
| Blue | F1 | 241 | Blue intensity (0-255) |
Each color channel uses 2 hex digits (00-FF), representing values from 0 (no intensity) to 255 (full intensity). This allows 16,777,216 unique colors (256³).
Common Colors
| Color | Hex | RGB Decimal |
|---|---|---|
| Black | #000000 | 0, 0, 0 |
| White | #FFFFFF | 255, 255, 255 |
| Red | #FF0000 | 255, 0, 0 |
| Green | #00FF00 | 0, 255, 0 |
| Blue | #0000FF | 0, 0, 255 |
| WritePadPro Primary | #6366F1 | 99, 102, 241 |
| WritePadPro Accent | #22D3EE | 34, 211, 238 |
Shorthand Hex
When both digits of each pair are the same, CSS allows 3-digit shorthand: #FFF = #FFFFFF (white), #000 = #000000 (black), #F00 = #FF0000 (red). This works because each digit is doubled: F becomes FF.
For another encoding scheme used in web development, see our Base64 Guide.
Binary in Computing
Binary is the native language of every digital computer. Understanding why and how binary works illuminates fundamental concepts in computing.
Why Computers Use Binary
Electronic circuits have two reliable states: voltage present (1) and voltage absent (0). Building circuits that distinguish between 2 states is cheap and reliable. Building circuits that distinguish between 10 states (for decimal) is expensive and error-prone. The reliability of two-state circuits is why binary became the standard for digital electronics.
Bits and Bytes
| Unit | Size | Range (unsigned) | Common Use |
|---|---|---|---|
| Bit | 1 binary digit | 0-1 | Single true/false value |
| Nibble | 4 bits | 0-15 (0-F hex) | Single hex digit |
| Byte | 8 bits | 0-255 (00-FF hex) | Single character (ASCII) |
| Kilobyte (KB) | 1,024 bytes | — | Short text document |
| Megabyte (MB) | 1,024 KB | — | High-quality photo |
| Gigabyte (GB) | 1,024 MB | — | Short HD video |
| Terabyte (TB) | 1,024 GB | — | Large hard drive |
These are the binary (power-of-two) definitions, also written KiB, MiB, GiB, and TiB. Storage makers and SI units use powers of 1,000 instead, so 1 KB = 1,000 bytes.
Binary in Networking
IP addresses are 32-bit binary numbers. The IPv4 address 192.168.1.1 is actually 11000000.10101000.00000001.00000001 in binary. Subnet masks, port numbers, and MAC addresses all use binary representation internally, often displayed in hex or decimal for human readability.
Binary in File Formats
Every file on your computer is stored as a sequence of binary bytes. A text file stores each character as a byte (e.g., 'A' = 01000001 in binary = 41 in hex = 65 in decimal). Images, audio, and video are all binary data interpreted by software according to format-specific rules (JPEG, PNG, MP3, MP4). For encoding binary data as text for transmission, see the Base64 Encoder & Decoder.
Octal: The Legacy System
Octal (base 8) is less common than binary and hex but appears in specific contexts.
Unix File Permissions
The most visible modern use of octal is Unix/Linux file permissions. The command chmod 755 file.txt uses octal notation:
- 7 (binary 111) = read + write + execute for owner
- 5 (binary 101) = read + execute for group
- 5 (binary 101) = read + execute for others
Each octal digit maps to exactly 3 binary bits, making it a compact representation for the 3-bit permission groups (rwx).
Historical Use
Early computers (PDP-8, many mainframes) used word sizes divisible by 3 (12-bit, 24-bit, 36-bit), making octal a natural grouping. The C programming language still supports octal literals with a leading zero: 0755 is octal 755, which is decimal 493. This is a common source of bugs — accidentally writing 010 (octal 10 = decimal 8) instead of 10 (decimal 10). For another historically significant encoding system, see our Roman Numerals Guide.
Quick Reference Conversion Table
| Decimal | Binary | Hex | Octal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 8 | 10 |
| 9 | 1001 | 9 | 11 |
| 10 | 1010 | A | 12 |
| 11 | 1011 | B | 13 |
| 12 | 1100 | C | 14 |
| 13 | 1101 | D | 15 |
| 14 | 1110 | E | 16 |
| 15 | 1111 | F | 17 |
| 16 | 10000 | 10 | 20 |
| 32 | 100000 | 20 | 40 |
| 64 | 1000000 | 40 | 100 |
| 128 | 10000000 | 80 | 200 |
| 255 | 11111111 | FF | 377 |
| 256 | 100000000 | 100 | 400 |
| 1024 | 10000000000 | 400 | 2000 |
Using WritePadPro's Binary & Hex Converter
WritePadPro's Binary & Hex Converter converts between all four number systems instantly.
Step 1: Enter a Number
Open the Binary & Hex Converter and enter a number in any base — binary (e.g., 101010), decimal (e.g., 42), hexadecimal (e.g., 2A), or octal (e.g., 52). Leave From on Auto-detect or pick the base yourself. Auto-detect reads 0b, 0o, and 0x prefixes, treats plain digits as decimal, and treats a run of four or more 0s and 1s as binary, so for octal choose Octal in the From menu or type 0o52.
Step 2: See All Conversions
Click Convert (or press Ctrl+Enter). The tool shows the value in all four systems at once, along with its size in bits. Enter 255 and see binary 11111111, hex FF, and octal 377. Whole numbers of any size convert exactly.
Step 3: Copy and Use
Use Copy next to any value (or Copy all) for code, network configuration, design work (hex colors), or educational materials. A Text mode also shows the UTF-8 bytes of any text in all four bases, and a bytes-to-text mode turns binary or hex bytes back into text.
Privacy
All conversion runs locally in your browser. No data is transmitted to any server. For encoding text as transmittable data, see our Morse Code Guide for historical encoding or the Base64 Guide for modern data encoding.
Summary
Four number systems dominate computing: decimal (base 10, everyday human use), binary (base 2, how computers store and process data), hexadecimal (base 16, compact binary representation for colors, memory addresses, and debugging), and octal (base 8, Unix permissions and legacy systems).
All four use the same place value principle — only the base changes. Conversion between them follows systematic methods: repeated division for decimal-to-other, positional multiplication for other-to-decimal, and grouping (4 bits = 1 hex digit, 3 bits = 1 octal digit) for binary-to-hex/octal.
Convert between all systems with WritePadPro's Binary & Hex Converter — enter any number in any base and see all four equivalents instantly.