Base Converter
Convert between various number bases including binary, octal, decimal, and hexadecimal.
Number(10) → Binary (Base 2)
Available Characters
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
0-9, A-Z (A=10, B=11, ..., Z=35)
Binary (Base 2)
Characters: 0, 1
Computer's fundamental language
e.g., 1010₂ = 10₁₀
Octal (Base 8)
Characters: 0-7
Used in Unix permissions
e.g., 12₈ = 10₁₀
Decimal (Base 10)
Characters: 0-9
Used in daily life
e.g., 10₁₀
Hexadecimal (Base 16)
Characters: 0-9, A-F
Color codes, memory addresses
e.g., A₁₆ = 10₁₀
Conversion Methods
Other base → Decimal: Multiply each digit by corresponding power of base and sum
Decimal → Other base: Divide by target base and arrange remainders in reverse order
Historical Development of Number Systems
Number systems have evolved alongside human civilization. From ancient Babylonian base-60, Mayan base-20, to our current decimal system, each civilization developed numerical systems suited to their needs.
Ancient Civilizations' Number Systems
- • Babylonian Base-60: Origin of time and angle measurement
- • Egyptian Decimal: Hieroglyph-based number system
- • Mayan Base-20: Based on fingers and toes
- • Roman Numerals: Additive notation system
Modern Number System Applications
- • Decimal: Standard for daily life
- • Binary: Computer's fundamental language
- • Hexadecimal: Programming and memory addresses
- • Octal: Unix permission system
Number Systems in Computer Science
Binary (Base 2)
Principle: Uses only 0 and 1
Usage: CPU, memory, logic circuits
Advantage: Easy to implement with electrical signals
Example: 1010₂ = 10₁₀
Applications: Digital communication, data storage
Hexadecimal (Base 16)
Principle: Uses 0-9, A-F
Usage: Memory addresses, color codes
Advantage: Compact representation of binary
Example: FF₁₆ = 255₁₀
Applications: Web development, system programming
Octal (Base 8)
Principle: Uses 0-7
Usage: Unix file permissions
Advantage: Groups 3 bits together
Example: 755₈ = 493₁₀
Applications: System administration, security settings
Number Systems in Programming
Real-world Examples
Color codes: #FF0000 (red)
Memory address: 0x7FFF5FBFF5B0
File permissions: chmod 755 (rwxr-xr-x)
Bit operations: 0b1010 & 0b1100
Network: IP address subnet masks
Debugging and Optimization
Memory dump: Check memory contents in hexadecimal
Bit flags: Manage states in binary
Hash values: Express checksums in hexadecimal
Encryption: Process bytes in hexadecimal
Compression: Manipulate data at bit level
Mathematical Principles of Base Conversion
Positional Notation
The value of each digit is determined by powers of the base.
1010₂ = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 10₁₀
Conversion Algorithms
Decimal → n-base
- 1. Divide decimal by n
- 2. Record remainder
- 3. Repeat until quotient is 0
- 4. Arrange remainders in reverse order
n-base → Decimal
- 1. Multiply each digit by power of base
- 2. Sum all values
- 3. Result is decimal value
Practical Applications of Number Systems
Web Development
- • CSS color codes (#RGB, #RRGGBB)
- • URL encoding (%20, %3A, etc.)
- • Base64 encoding (email, images)
- • Unicode character codes (U+0041)
System Management
- • File permission settings (chmod 755)
- • Network configuration (subnet masks)
- • Memory address analysis
- • Log file analysis
💻 Practical Tips
• Developer Tools: You can directly check hexadecimal color codes in browser developer tools.
• Calculator Usage: Use programmer calculators for easy base conversion.
• Bit Operations: Understanding binary helps you use bit operators (&, |, ^, ~) effectively.
• Memory Optimization: Understanding number systems helps optimize memory usage.