Binary Calculator
Add, subtract, multiply, and divide binary numbers.
Binary calculator
Add two binary numbers.
Use conversion mode to switch between binary, decimal, and hexadecimal.
Leading zeros may be useful for fixed-width values.
Bitwise operations compare bits position by position.
Binary result
1101
Binary addition
Decimal equivalent
13
Same value in base 10.
Hexadecimal equivalent
D
Same value in base 16.
Binary result
1101
Grouped by four bits for readability.
Bit length
4
Number of bits needed to display the unsigned magnitude.
Remainder
-
Only shown for division when applicable.
Step-by-step interpretation
Convert 1010₂ to 10₁₀.
Convert 11₂ to 3₁₀.
10 + 3 = 13.
Convert the result back to binary: 1101₂.
Number system
Binary number system explanation
Base 2
Binary is base 2, so each digit can only be 0 or 1.
Bits
Binary digits are called bits, short for binary digits.
Powers of 2
Each place value is a power of 2, starting at 2^0 on the right.
Computers
Computers use binary because bits map naturally to off and on states.
Arithmetic
Binary arithmetic operations
Addition
Binary addition carries when 1 + 1 = 10₂.
Subtraction
Binary subtraction may borrow from the next place value.
Multiplication
Binary multiplication works like decimal multiplication, but only 0 and 1 appear.
Division
Binary division follows long division ideas and may leave a remainder.
Conversion
Binary to decimal conversion
To convert binary to decimal, multiply each bit by its place value and add the results.
| Binary | 1 | 1 | 0 | 1 |
| Place value | 8 | 4 | 2 | 1 |
| Contribution | 8 | 4 | 0 | 1 |
1101₂ = 1x8 + 1x4 + 0x2 + 1x1 = 13₁₀
Conversion
Decimal to binary conversion
Divide by 2
Repeatedly divide by 2 and track each remainder.
13 / 2 = 6 remainder 1
6 / 2 = 3 remainder 0
3 / 2 = 1 remainder 1
1 / 2 = 0 remainder 1
13₁₀ = 1101₂
Developer basics
Bitwise operations basics
Truth table
| A | B | AND | OR | XOR |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
AND
1 only when both bits are 1.
OR
1 when at least one bit is 1.
XOR
1 when bits are different.
Shifts
Move bits left or right by a chosen amount.
Examples
Worked examples
1010 + 11
Add with base-2 carries
1010 + 0011 = 1101
13₁₀
1101 - 101
Subtract after aligning bits
1101 - 0101 = 1000
8₁₀
101 x 11
Multiply by each 1 bit
101 x 11 = 1111
15₁₀
1101₂ to decimal
Add powers of 2
8 + 4 + 0 + 1
13₁₀
25₁₀ to binary
Divide by 2
remainders 1,0,0,1,1
11001₂
1010 AND 1100
1 only where both bits are 1
1010 AND 1100
1000₂
1010 OR 1100
1 where either bit is 1
1010 OR 1100
1110₂
101 << 1
Move bits left once
101 becomes 1010
10₁₀
Avoid errors
Common mistakes
Rules
Formula and rule explanation
Binary place value
Value = sum of each bit multiplied by 2 raised to its position.
Binary to decimal
Decimal = b_n x 2^n + b_(n-1) x 2^(n-1) + ... + b_0.
Decimal to binary
Repeatedly divide by 2 and read remainders from last to first.
Addition rules
0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 10₂.
Bitwise AND
1 only when both bits are 1.
Bitwise OR and XOR
OR is 1 when at least one bit is 1. XOR is 1 when bits are different.
FAQ
Binary calculator questions
A binary number is a base 2 number that uses only 0 and 1. Each digit is a bit, and each place value represents a power of 2.
Related tools