🔢 Number Base Converter
Convert between Binary, Decimal, Hexadecimal, and Octal
📥 Input Number
📊 Conversion Results
Binary (Base 2)
Octal (Base 8)
Decimal (Base 10)
Hexadecimal (Base 16)
Conversion Reference Table (0-15)
| Decimal | Binary | Octal | Hexadecimal |
|---|
📚 Understanding Number Bases
What are Number Bases?
A number base (or radix) is the number of unique digits used to represent numbers in a positional numeral system. Different bases are used for different purposes in mathematics, computing, and everyday life.
Binary (Base 2)
Uses only 0 and 1. Each digit represents a power of 2. Binary is the fundamental language of computers and digital electronics.
Example: 1010₂ = (1×2³) + (0×2²) + (1×2¹) + (0×2⁰) = 8 + 0 + 2 + 0 = 10₁₀
- Uses: Computer architecture, digital circuits, Boolean logic
- Range: Each bit can be 0 or 1
- Conversion: Group in sets of 4 for hex, sets of 3 for octal
Octal (Base 8)
Uses digits 0-7. Each digit represents a power of 8. Often used as a shorthand for binary in computing, especially in Unix file permissions.
Example: 52₈ = (5×8¹) + (2×8⁰) = 40 + 2 = 42₁₀
- Uses: Unix file permissions (chmod 755), older computer systems
- Range: Each digit can be 0-7
- Conversion: Three binary digits = one octal digit
Decimal (Base 10)
Uses digits 0-9. The standard number system humans use daily. Each digit represents a power of 10.
Example: 365₁₀ = (3×10²) + (6×10¹) + (5×10⁰) = 300 + 60 + 5
- Uses: Everyday mathematics, business, science, general counting
- Range: Each digit can be 0-9
- Conversion: Base for most human calculations
Hexadecimal (Base 16)
Uses digits 0-9 and letters A-F (where A=10, B=11, C=12, D=13, E=14, F=15). Commonly used in programming for colors, memory addresses, and compact binary representation.
Example: 2A₁₆ = (2×16¹) + (10×16⁰) = 32 + 10 = 42₁₀
- Uses: Web colors (#FF0000), MAC addresses, memory dumps, assembly language
- Range: Each digit can be 0-9, A-F
- Conversion: Four binary digits = one hex digit
Quick Conversion Tips
- Binary ↔ Hexadecimal: Group binary digits in sets of 4. Each group represents one hex digit. Example: 1010 1100₂ = AC₁₆
- Binary ↔ Octal: Group binary digits in sets of 3. Each group represents one octal digit. Example: 101 010₂ = 52₈
- Hex to Decimal: Multiply each digit by 16 raised to its position power, then sum
- Decimal to Binary: Repeatedly divide by 2 and record remainders
Frequently Asked Questions
Why do computers use binary?
Computers use binary because digital circuits can easily represent two states: on (1) and off (0). This makes binary the most reliable and efficient system for electronic computing. All data in computers, from text to images, is ultimately stored and processed as binary numbers.
When should I use hexadecimal instead of binary?
Hexadecimal is more compact and easier to read than binary. Use hex when you need to represent binary data in a human-readable format, such as color codes (#FF5733), memory addresses, or debugging. One hex digit represents exactly four binary digits, making conversion straightforward.
What is octal used for today?
Octal is primarily used in Unix/Linux file permissions (e.g., chmod 755) and some legacy systems. While less common than hex, it's still useful because three binary digits convert to one octal digit, making it a compact representation for certain applications.
How do I convert between bases manually?
To convert from any base to decimal: multiply each digit by the base raised to its position power (starting from 0 on the right), then sum. To convert from decimal to another base: repeatedly divide by the target base and record remainders in reverse order. For binary-hex-octal conversions, use grouping methods.
What's the largest number I can convert?
This calculator can handle very large numbers limited only by JavaScript's number precision (up to 2^53 - 1 or about 9 quadrillion). For even larger numbers, you may need specialized big integer libraries. The conversion algorithms work the same regardless of size.
Can I convert negative numbers or decimals?
This calculator handles positive integers. Negative numbers in computers use two's complement representation in binary. Decimal fractions require different conversion methods (multiplying by the base for the fractional part). For these special cases, use specialized calculators or conversion methods.