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โโ.