Binary Calculator — Free Base-2 Math & Bitwise Tool
Calculate with binary numbers in base 2, including arithmetic and bitwise operations. Convert and compute results instantly for coding and study.
About this calculator
About the Binary Calculator
The binary number system (base-2) is the foundation of all modern computing. Every piece of data in your computer—photos, videos, documents, and programs—is ultimately stored as sequences of 0s and 1s. Our binary calculator helps you perform arithmetic operations on binary numbers and convert between binary, decimal, hexadecimal, and octal systems.
What you can do:
- Binary arithmetic: Addition, subtraction, multiplication, and division
- Base conversions: Binary ↔ Decimal ↔ Hexadecimal ↔ Octal
- Bitwise operations: AND, OR, XOR, NOT, shift left, shift right
- Two's complement: Work with signed (negative) binary numbers
Understanding Binary Numbers
Binary uses only two digits: 0 and 1. Each position represents a power of 2:
| Position (from right) | Value | Power of 2 |
|---|---|---|
| 0 | 1 | 2⁰ |
| 1 | 2 | 2¹ |
| 2 | 4 | 2² |
| 3 | 8 | 2³ |
| 4 | 16 | 2⁴ |
| 5 | 32 | 2⁵ |
| 6 | 64 | 2⁶ |
| 7 | 128 | 2⁷ |
Example: Binary 1011 = 1×8 + 0×4 + 1×2 + 1×1 = 11 in decimal
Binary Addition
Binary addition follows these rules:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (write 0, carry 1)
- 1 + 1 + 1 = 11 (write 1, carry 1)
Example: 1011 + 1101
¹ ¹ (carries)
1011 (11 in decimal)
+ 1101 (13 in decimal)
------
11000 (24 in decimal)
Binary Subtraction
- 0 - 0 = 0
- 1 - 0 = 1
- 1 - 1 = 0
- 0 - 1 = 1 (with borrow from next column)
Example: 1101 - 1011
1101 (13 in decimal)
- 1011 (11 in decimal)
------
0010 (2 in decimal)
Binary Multiplication
Binary multiplication is similar to decimal but simpler since you only multiply by 0 or 1:
Example: 101 × 11
101 (5 in decimal)
× 11 (3 in decimal)
-----
101 (101 × 1)
101 (101 × 1, shifted left)
-----
1111 (15 in decimal)
Converting Binary to Decimal
Multiply each bit by its corresponding power of 2 and sum:
Example: Convert 11010 to decimal
- 1 × 16 = 16
- 1 × 8 = 8
- 0 × 4 = 0
- 1 × 2 = 2
- 0 × 1 = 0
- Total: 16 + 8 + 0 + 2 + 0 = 26
Converting Decimal to Binary
Divide by 2 repeatedly and record the remainders:
Example: Convert 45 to binary
- 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
Read remainders bottom to top: 101101
Binary to Hexadecimal Conversion
Group binary digits into sets of 4 (from right) and convert:
Example: Convert 10110110 to hex
- 1011 = B
- 0110 = 6
- Result: B6
Real-World Binary Applications
| Application | How Binary Is Used |
|---|---|
| IP addresses | IPv4 addresses are 32-bit binary numbers (e.g., 192.168.1.1 = 11000000.10101000.00000001.00000001) |
| File sizes | 1 KB = 1024 bytes (2¹⁰), 1 MB = 1,048,576 bytes (2²⁰) |
| Color codes | RGB values are 8-bit binary (0-255 per channel) |
| Permissions | Unix file permissions use 3-bit binary (rwx = 111 = 7) |
| Subnet masks | Network masks like /24 = 11111111.11111111.11111111.00000000 |
| ASCII | Characters encoded as 7 or 8-bit binary |
Frequently Asked Questions
Why do computers use binary?
Electronic circuits have two states: on (1) and off (0). Binary maps perfectly to these physical states, making it reliable and efficient.
What's the largest number an 8-bit binary can represent?
11111111 = 255 (unsigned). With two's complement (signed), the range is -128 to +127.
What is a bit, nibble, and byte?
- Bit: Single binary digit (0 or 1)
- Nibble: 4 bits (half a byte)
- Byte: 8 bits
How do I represent negative numbers in binary?
Computers use two's complement: invert all bits and add 1. For example, -5 in 8-bit: 00000101 → 11111010 + 1 = 11111011
What is bitwise AND/OR/XOR?
- AND: Output 1 only if both inputs are 1
- OR: Output 1 if either input is 1
- XOR: Output 1 if inputs are different
Related Calculators
- Hex Calculator - Hexadecimal arithmetic and conversions
- Decimal to Binary Calculator - Focused decimal-to-binary converter
- Scientific Calculator - Advanced mathematical operations
- ASCII Converter - Text to binary/ASCII conversions
- Data Storage Converter - Convert between bits, bytes, KB, MB, GB, TB
Comments
Loading comments…