Base Converter
Convert numbers between different bases including binary, octal, decimal, and hexadecimal. Essential for computer science, programming, and understanding digital systems.
Convert Number Bases
Enter a number and select the bases to convert between:
Binary (2): 0,1 • Octal (8): 0-7 • Decimal (10): 0-9 • Hex (16): 0-9,A-F
Understanding Number Systems
Number systems are fundamental to computer science and mathematics. Different bases are used for different purposes, from binary in computers to hexadecimal for memory addresses.
Common Number Systems
🔢 Decimal (Base 10)
Digits: 0-9
Most familiar system
Used for everyday counting
10 distinct digits
Positional notation with powers of 10
💻 Binary (Base 2)
Digits: 0,1
Foundation of computing
Represents on/off states
Used by all digital computers
Each digit is a bit (binary digit)
🔧 Octal (Base 8)
Digits: 0-7
Used in early computers
Convenient for byte representation
3 bits = 1 octal digit
Common in Unix file permissions
🎨 Hexadecimal (Base 16)
Digits: 0-9,A-F
Compact binary representation
4 bits = 1 hex digit
Used for memory addresses
Common in HTML color codes
Positional Notation
| Base | Example | Calculation | Decimal Value |
|---|---|---|---|
| Binary (2) | 1010₂ | (1×2³) + (0×2²) + (1×2¹) + (0×2⁰) | 8 + 0 + 2 + 0 = 10 |
| Octal (8) | 52₈ | (5×8¹) + (2×8⁰) | 40 + 2 = 42 |
| Decimal (10) | 42₁₀ | (4×10¹) + (2×10⁰) | 40 + 2 = 42 |
| Hexadecimal (16) | 2A₁₆ | (2×16¹) + (10×16⁰) | 32 + 10 = 42 |
Famous Numbers in Different Bases
| Number | Binary | Octal | Decimal | Hexadecimal | Description |
|---|---|---|---|---|---|
| 42 | 101010 | 52 | 42 | 2A | Answer to Life, Universe, Everything |
| 255 | 11111111 | 377 | 255 | FF | Maximum 8-bit unsigned value |
| 256 | 100000000 | 400 | 256 | 100 | 2⁸ (one byte + 1) |
| 1024 | 10000000000 | 2000 | 1024 | 400 | 2¹⁰ (one kilobyte in binary) |
| 4096 | 1000000000000 | 10000 | 4096 | 1000 | 4K memory page |
Computer Science Applications
🧠 Memory Addressing
Hexadecimal for memory locations
Binary for bit manipulation
Understanding pointer arithmetic
Memory allocation concepts
Computer architecture fundamentals
🎨 Digital Colors
RGB values in hexadecimal
HTML color codes (#RRGGBB)
Image pixel representation
Color depth calculations
Graphics file formats
🔐 Cryptography
Binary operations in encryption
Hex representation of keys
Hash function outputs
Digital signature algorithms
Secure random generation
Programming Language Examples
💻 C/C++
0b prefix for binary literals
0x prefix for hexadecimal
printf format specifiers
Bit manipulation operators
Memory address printing
🐍 Python
0b prefix for binary
0o prefix for octal
0x prefix for hexadecimal
bin(), oct(), hex() functions
format() method with bases
☕ JavaScript
0b for binary literals
0o for octal literals
0x for hexadecimal
parseInt() with radix
toString() with base parameter
Historical Number Systems
🗂️ Babylonian (Base 60)
Used for time and angles
Still used in modern timekeeping
60 seconds = 1 minute
60 minutes = 1 degree
Ancient mathematical system
📏 Mayan (Base 20)
Vigesimal counting system
Used positional notation
Complex calendar systems
Influenced by finger counting
Advanced mathematical concepts
🏛️ Roman Numerals
Additive and subtractive notation
Not truly positional
Limited to certain values
Still used in some contexts
Symbolic rather than mathematical
Binary Operations
➕ Binary Addition
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (carry 1)
Fundamental to computer arithmetic
✖️ Binary Multiplication
0 × 0 = 0
0 × 1 = 0
1 × 0 = 0
1 × 1 = 1
Used in digital multiplication circuits
🔀 Bitwise Operations
AND (&): 1 & 1 = 1, otherwise 0
OR (|): 0 | 0 = 0, otherwise 1
XOR (^): 1 ^ 1 = 0, 0 ^ 0 = 0, otherwise 1
Essential for computer logic
💻 Programming Tip: Remember that computers use binary internally, but hexadecimal provides a compact way to represent binary data. Each hex digit represents exactly 4 bits, making conversions simple: 1010₂ = A₁₆.