Binary Calculator – Binary to Decimal, Hex, Octal Converter with Steps
Calculate binary addition, subtraction, multiplication with this comprehensive binary calculator. Convert between binary, decimal, hexadecimal, and octal number systems instantly. Perform binary operations (add, subtract, multiply), convert hex to binary, binary to decimal with step-by-step solutions. Supports signed binary numbers, two's complement, binary coded decimal (BCD), ASCII conversion, and binary logarithm calculations. Perfect for computer science students, programmers, and digital electronics enthusiasts.
🔢 Binary Arithmetic Calculator
Add, subtract, multiply binary numbers
Binary Arithmetic Result
Step-by-Step Solution:
🔄 Binary Decimal Converter
Convert between binary and decimal
Conversion Result
Conversion Steps:
🔷 Hexadecimal Binary Converter
Convert between hex and binary
Hex-Binary Conversion
Conversion Method:
🔶 Octal Binary Converter
Convert between octal and binary
Octal-Binary Conversion
Conversion Method:
⚙️ Advanced Binary Tools
Signed binary, complement, BCD converter
Advanced Result
Explanation:
Understanding Binary Number System
The binary number system (base-2) is a positional numeral system that uses only two digits: 0 and 1. It is the foundation of all digital computers and electronics. Each digit position represents a power of 2, making it fundamentally different from our everyday decimal (base-10) system. Binary is essential for computer science, digital logic, programming, and electronics engineering.
Binary to Decimal Conversion
Converting binary to decimal involves multiplying each binary digit by its positional value (power of 2) and summing the results.
Binary to Decimal Formula:
Where:
- digit = Binary digit (0 or 1)
- position = Position from right (starting at 0)
- Σ = Sum of all terms
Example: Convert 10110101 (binary) to decimal
Step 1: Write positional values (right to left, starting from 0)
Position: 7 6 5 4 3 2 1 0
Binary: 1 0 1 1 0 1 0 1
Power: 2⁷ 2⁶ 2⁵ 2⁴ 2³ 2² 2¹ 2⁰
Step 2: Calculate each position
Position 0: 1 × 2⁰ = 1 × 1 = 1
Position 1: 0 × 2¹ = 0 × 2 = 0
Position 2: 1 × 2² = 1 × 4 = 4
Position 3: 0 × 2³ = 0 × 8 = 0
Position 4: 1 × 2⁴ = 1 × 16 = 16
Position 5: 1 × 2⁵ = 1 × 32 = 32
Position 6: 0 × 2⁶ = 0 × 64 = 0
Position 7: 1 × 2⁷ = 1 × 128 = 128
Step 3: Sum all values
128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181
Result: 10110101₂ = 181₁₀
Decimal to Binary Conversion
Converting decimal to binary uses the division-by-2 method (successive division) or subtraction method.
Decimal to Binary Formula (Division Method):
Algorithm:
- 1. Divide decimal number by 2
- 2. Record remainder (0 or 1)
- 3. Use quotient for next division
- 4. Repeat until quotient = 0
- 5. Read remainders bottom-to-top
Example: Convert 181 (decimal) to binary
Division Method:
181 ÷ 2 = 90 remainder 1 (LSB - least significant bit)
90 ÷ 2 = 45 remainder 0
45 ÷ 2 = 22 remainder 1
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5 remainder 1
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1 (MSB - most significant bit)
Read from bottom to top: 10110101
Result: 181₁₀ = 10110101₂
Verification: 128 + 32 + 16 + 4 + 1 = 181 ✓
Binary Addition Calculator
Binary addition follows rules similar to decimal addition, but with only two digits (0 and 1). When sum exceeds 1, we carry to the next position.
Binary Addition Rules
- 0 + 0 = 0 (no carry)
- 0 + 1 = 1 (no carry)
- 1 + 0 = 1 (no carry)
- 1 + 1 = 10 (write 0, carry 1)
- 1 + 1 + 1 (with carry) = 11 (write 1, carry 1)
Example: 1011 + 110
1011 (11 in decimal)
+ 0110 (6 in decimal)
------
Step-by-step (right to left):
Position 0: 1 + 0 = 1
Position 1: 1 + 1 = 10 (write 0, carry 1)
Position 2: 0 + 1 + 1(carry) = 10 (write 0, carry 1)
Position 3: 1 + 0 + 1(carry) = 10 (write 0, carry 1)
Position 4: 1(carry) = 1
Result: 10001 (17 in decimal)
Verification: 11 + 6 = 17 ✓
Binary Subtraction Calculator
Binary subtraction can be performed using direct subtraction or two's complement addition (preferred in computers).
Binary Subtraction Rules (Direct Method)
- 0 - 0 = 0
- 1 - 0 = 1
- 1 - 1 = 0
- 0 - 1 = 1 (borrow 1) → 10 - 1 = 1
Example: 1011 - 110
1011 (11 in decimal)
- 0110 (6 in decimal)
------
Step-by-step:
Position 0: 1 - 0 = 1
Position 1: 1 - 1 = 0
Position 2: 0 - 1 = need borrow → 10 - 1 = 1
Position 3: 1 - 0 - 1(borrowed) = 0
Result: 0101 = 101 (5 in decimal)
Verification: 11 - 6 = 5 ✓
Hexadecimal to Binary Conversion
Each hexadecimal digit converts to exactly 4 binary bits (nibble). This makes hex-binary conversion very straightforward.
Hex to Binary Mapping
| Hex | Binary (4-bit) | Decimal |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| A | 1010 | 10 |
| B | 1011 | 11 |
| C | 1100 | 12 |
| D | 1101 | 13 |
| E | 1110 | 14 |
| F | 1111 | 15 |
Example: Convert 2F (hex) to binary
Step 1: Convert each hex digit separately
2 (hex) → 0010 (binary)
F (hex) → 1111 (binary)
Step 2: Concatenate the binary groups
Result: 2F₁₆ = 00101111₂ = 47₁₀
Octal to Binary Conversion
Each octal digit converts to exactly 3 binary bits. Octal is often used as shorthand for binary in computing.
Octal to Binary Mapping
| Octal | Binary (3-bit) | Decimal |
|---|---|---|
| 0 | 000 | 0 |
| 1 | 001 | 1 |
| 2 | 010 | 2 |
| 3 | 011 | 3 |
| 4 | 100 | 4 |
| 5 | 101 | 5 |
| 6 | 110 | 6 |
| 7 | 111 | 7 |
Example: Convert 57 (octal) to binary
Step 1: Convert each octal digit
5 (octal) → 101 (binary)
7 (octal) → 111 (binary)
Step 2: Concatenate
Result: 57₈ = 101111₂ = 47₁₀
Signed Binary Numbers
Signed binary numbers represent both positive and negative values using different methods:
Sign-Magnitude Representation
MSB (Most Significant Bit) = sign bit (0 = positive, 1 = negative). Remaining bits = magnitude.
Two's Complement (Most Common)
Standard method for signed integers in computers. Range: -2^(n-1) to 2^(n-1)-1 for n bits.
Two's Complement Steps:
- 1. One's complement: Invert all bits (0→1, 1→0)
- 2. Add 1 to the result
Example: -10 in 8-bit two's complement
Step 1: Convert +10 to binary
10₁₀ = 00001010₂
Step 2: One's complement (invert bits)
11110101
Step 3: Add 1
11110101 + 1 = 11110110
Result: -10₁₀ = 11110110₂ (8-bit two's complement)
Verification (convert back):
MSB = 1 → negative number
Invert: 00001001, Add 1: 00001010 = 10 → -10 ✓
Frequently Asked Questions
Binary Number System Applications
Computer Science & Programming
- Data Storage: All digital data stored as binary (files, images, videos)
- Boolean Logic: True/False represented as 1/0
- Bitwise Operations: AND, OR, XOR, NOT, bit shifts
- Memory Addressing: RAM addresses in binary/hex
- Network Protocols: IP addresses, subnet masks
Digital Electronics
- Logic Gates: AND, OR, NOT, NAND, NOR gates operate on binary
- Microprocessors: All CPU operations in binary
- Digital Signals: High (1) and Low (0) voltage levels
- Error Detection: Parity bits, checksums
Number System Comparison
| System | Base | Digits | Example | Use Case |
|---|---|---|---|---|
| Binary | 2 | 0, 1 | 1011₂ = 11₁₀ | Computer internal representation |
| Octal | 8 | 0-7 | 13₈ = 11₁₀ | Unix file permissions, legacy systems |
| Decimal | 10 | 0-9 | 11₁₀ | Human-readable numbers |
| Hexadecimal | 16 | 0-9, A-F | B₁₆ = 11₁₀ | Memory addresses, color codes |



