Number Base Conversion Calculator
Base Conversion Calculator
Convert numbers between binary (base-2), octal (base-8), decimal (base-10), hexadecimal (base-16) and other bases. Step-by-step conversion process with bit visualization.
Conversion Result
Binary Bit Representation:
Place Value Breakdown:
Step-by-Step Conversion:
Power of Two Table:
| Power | 2ⁿ | Decimal | Binary | Hex |
|---|
Number Systems Comparison:
| Decimal | Binary | Octal | Hexadecimal |
|---|
Two's Complement (for negative numbers):
Number base conversion allows representation of values in different numeral systems.
What is Number Base Conversion?
Number base conversion is the process of changing a number from one base (radix) to another. The base determines how many digits are used in the number system and the value of each digit position. Common bases include binary (base-2), octal (base-8), decimal (base-10), and hexadecimal (base-16).
Common Number Bases
Binary (Base-2)
Computer systems
Digital logic
Octal (Base-8)
Unix permissions
Legacy systems
Decimal (Base-10)
Everyday use
Human counting
Hexadecimal (Base-16)
Memory addresses
Color codes
Conversion Methods
1. Decimal to Any Base
Divide by base, record remainders:
Convert 255₁₀ to binary:
255 ÷ 2 = 127 remainder 1
127 ÷ 2 = 63 remainder 1
63 ÷ 2 = 31 remainder 1
31 ÷ 2 = 15 remainder 1
15 ÷ 2 = 7 remainder 1
7 ÷ 2 = 3 remainder 1
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
Read remainders backward: 11111111₂
2. Any Base to Decimal
Multiply digits by base powers:
Convert 1011₂ to decimal:
1×2³ + 0×2² + 1×2¹ + 1×2⁰
= 1×8 + 0×4 + 1×2 + 1×1
= 8 + 0 + 2 + 1 = 11₁₀
3. Binary ⇔ Hexadecimal
Group binary digits (4 bits = 1 hex digit):
11111111₂ to hexadecimal:
Group: 1111 1111
1111₂ = F₁₆, 1111₂ = F₁₆
Result: FF₁₆
4. Binary ⇔ Octal
Group binary digits (3 bits = 1 octal digit):
11111111₂ to octal:
Group: 011 111 111
011₂ = 3₈, 111₂ = 7₈, 111₂ = 7₈
Result: 377₈
Real-World Applications
Computer Science & Programming
- Memory addressing: Hexadecimal for memory locations
- Bit manipulation: Binary for flags and bit fields
- Color representation: Hex codes in HTML/CSS (e.g., #FF0000 = red)
- Network protocols: IP addresses in decimal-dot notation
Digital Electronics
- Logic gates: Binary operations (AND, OR, XOR)
- Microcontrollers: Register manipulation in hex/binary
- Signal processing: Binary data streams
- FPGA programming: Configuration in hex format
Mathematics & Cryptography
- Number theory: Studying properties of different bases
- Error detection: Parity bits and checksums
- Encryption: Binary operations in cryptographic algorithms
- Data compression: Efficient number representation
Everyday Computing
- File permissions: Unix octal permissions (chmod 755)
- Character encoding: ASCII/Unicode values in hex
- Debugging: Memory dumps in hex format
- Web development: Color codes, URL encoding
Common Conversion Table
| Decimal | Binary | Octal | Hexadecimal | Base-4 |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 | 2 |
| 3 | 11 | 3 | 3 | 3 |
| 4 | 100 | 4 | 4 | 10 |
| 5 | 101 | 5 | 5 | 11 |
| 6 | 110 | 6 | 6 | 12 |
| 7 | 111 | 7 | 7 | 13 |
| 8 | 1000 | 10 | 8 | 20 |
| 9 | 1001 | 11 | 9 | 21 |
| 10 | 1010 | 12 | A | 22 |
| 15 | 1111 | 17 | F | 33 |
| 16 | 10000 | 20 | 10 | 100 |
| 255 | 11111111 | 377 | FF | 3333 |
Step-by-Step Conversion Examples
Example 1: Decimal 255 to Binary
- Start with 255 (decimal)
- Divide by 2: 255 ÷ 2 = 127 remainder 1
- Divide 127 by 2: 127 ÷ 2 = 63 remainder 1
- Divide 63 by 2: 63 ÷ 2 = 31 remainder 1
- Divide 31 by 2: 31 ÷ 2 = 15 remainder 1
- Divide 15 by 2: 15 ÷ 2 = 7 remainder 1
- Divide 7 by 2: 7 ÷ 2 = 3 remainder 1
- Divide 3 by 2: 3 ÷ 2 = 1 remainder 1
- Divide 1 by 2: 1 ÷ 2 = 0 remainder 1
- Read remainders from bottom to top: 11111111
- Result: 255₁₀ = 11111111₂
Example 2: Binary 101101 to Decimal
- Binary number: 1 0 1 1 0 1
- Assign powers: 2⁵ 2⁴ 2³ 2² 2¹ 2⁰
- Multiply: 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1
- Calculate: 32 + 0 + 8 + 4 + 0 + 1 = 45
- Result: 101101₂ = 45₁₀
Example 3: Hex 1A3F to Binary
- Hex digits: 1 A 3 F
- Convert each hex digit to 4-bit binary:
- 1₁₆ = 0001₂
- A₁₆ = 1010₂
- 3₁₆ = 0011₂
- F₁₆ = 1111₂
- Combine: 0001 1010 0011 1111
- Remove leading zeros: 1101000111111
- Result: 1A3F₁₆ = 1101000111111₂
Special Number Representations
| Representation | Description | Example | Use Case |
|---|---|---|---|
| Two's Complement | Negative numbers in binary | -5₁₀ = 11111011₂ (8-bit) | Signed integer arithmetic |
| One's Complement | Flip all bits for negative | -5₁₀ = 11111010₂ (8-bit) | Historical systems |
| Sign-Magnitude | MSB = sign, rest = magnitude | -5₁₀ = 10000101₂ (8-bit) | Floating point sign bit |
| BCD (Binary Coded Decimal) | Each decimal digit as 4 bits | 45₁₀ = 0100 0101 | Financial calculations |
| Gray Code | Adjacent values differ by 1 bit | 3₁₀ = 0010₂ (Gray) | Rotary encoders |
Related Calculators
Frequently Asked Questions (FAQs)
Q: Why do computers use binary instead of decimal?
A: Computers use binary because electronic components (transistors) have two stable states: on (1) and off (0). Binary is reliable, simple to implement electronically, and forms the foundation of digital logic gates.
Q: What's the advantage of hexadecimal over binary?
A: Hexadecimal is more compact than binary. One hex digit represents 4 binary digits (bits), making it easier for humans to read and write large binary values (e.g., memory addresses, color codes).
Q: How do I convert fractions between bases?
A: For fractional parts, multiply by the target base repeatedly. Example: Convert 0.625₁₀ to binary: 0.625×2=1.25 (1), 0.25×2=0.5 (0), 0.5×2=1.0 (1) → 0.101₂.
Q: What is two's complement and why is it important?
A: Two's complement is a method for representing signed integers in binary. It simplifies arithmetic operations (addition/subtraction work the same for signed and unsigned) and eliminates the "negative zero" problem found in other representations.
Convert numbers between any base with Toolivaa's free Number Base Conversion Calculator, and explore more computational tools in our Math Calculators collection.