Binary Calculator
Perform binary arithmetic and convert between binary and decimal. Enter binary numbers using only 0 and 1.
Results
Binary Arithmetic
Binary is the base-2 number system used by all digital computers. Every binary digit (bit) is either 0 or 1, corresponding to the off and on states of transistors. Binary arithmetic follows the same positional rules as decimal but with a base of 2 instead of 10.
Binary Addition 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). Work right-to-left, carrying to the next position just like decimal addition. Example: 1010 + 0110 = 10000 (10 + 6 = 16).
Binary Subtraction
0−0=0. 1−0=1. 1−1=0. 0−1 requires borrowing: borrow from the next left bit (0−1 becomes 10−1=1, and the left bit decreases by 1). In practice, computers perform subtraction using two's complement addition.
Binary Multiplication and Division
Binary multiplication is simple: multiply each bit of one number by the other, shift left by position, and add. 101 × 11 = 101 + 1010 = 1111 (5 × 3 = 15). Binary division is long division in base 2 — subtract the divisor when possible, bring down next bit.
Converting Binary to Decimal
Multiply each bit by 2 raised to its position (0 from right) and sum. Binary 11001: 1×16 + 1×8 + 0×4 + 0×2 + 1×1 = 25. Each bit position doubles in value moving left.
Worked Example: Adding 1101 + 1011
Work right to left, carrying when the sum exceeds 1:
Position 0: 1 + 1 = 10 → write 0, carry 1.
Position 1: 0 + 1 + 1 (carry) = 10 → write 0, carry 1.
Position 2: 1 + 0 + 1 (carry) = 10 → write 0, carry 1.
Position 3: 1 + 1 + 1 (carry) = 11 → write 1, carry 1.
Position 4: 0 + 0 + 1 (carry) = 1 → write 1.
Result: 11000. Verification: 1101 = 13, 1011 = 11. 13 + 11 = 24 = 11000 ✓.
Binary Powers of 2 Reference
| Bits | Max binary | Decimal value |
|---|---|---|
| 4-bit | 1111 | 15 |
| 8-bit (byte) | 11111111 | 255 |
| 16-bit | 1111111111111111 | 65,535 |
| 32-bit | 11...1 (32 ones) | 4,294,967,295 |
Frequently Asked Questions
Add column by column from right to left: 0+0=0, 1+0=1, 1+1=10 (0 carry 1), 1+1+1=11. Carry the 1 to the next column just like in decimal addition.
1111 binary = 1×8 + 1×4 + 1×2 + 1×1 = 15 decimal. It's the largest 4-bit number.
11111111 = 2⁸ − 1 = 255. An 8-bit unsigned byte can represent values 0 through 255, giving 256 distinct values (2⁸).
Computers use two's complement: flip all bits of the subtrahend (one's complement) then add 1. To subtract 0110 from 1010: flip 0110→1001, add 1→1010, then add: 1010+1010=10100, take last 4 bits=0100 (which is 4 = 10−6).
Electronic transistors reliably hold two states: on (1) or off (0). Using more states would be impractical at nanoscale. Binary arithmetic is also mathematically simple and circuits implementing it are fast and reliable.
Repeatedly divide by 2 and note remainders. Example: 25 ÷ 2 = 12 R1; 12 ÷ 2 = 6 R0; 6 ÷ 2 = 3 R0; 3 ÷ 2 = 1 R1; 1 ÷ 2 = 0 R1. Read remainders from bottom to top: 11001. Verify: 16+8+1 = 25 ✓.
Bitwise operations apply logical operations to corresponding bits: AND (1 only if both bits are 1), OR (1 if either bit is 1), XOR (1 if bits differ), NOT (flips all bits), and bit shifts (move all bits left or right). These are extremely fast operations used in graphics, encryption, and systems programming.