Home / Mathematics / Binary Calculator
MATHEMATICS NUMBER SYSTEMSBinary Calculator
Add, subtract, multiply and divide binary numbers with the working shown the way you would write it on paper — carries, borrows and partial products included. Plus bitwise AND, OR, XOR and NOT, and a converter between binary, decimal, hex and octal.
Binary Arithmetic
Type two binary numbers, pick an operation, and read the answer with its working. Spaces are ignored, and a 0b prefix is fine.
Result
The working
Bitwise Operations
AND, OR and XOR compare the two numbers bit by bit. NOT flips every bit of the first number at the width you choose.
Result
Base Converter
Enter a value in any base and read it in all four. A negative decimal also gets its two's complement form.
Result
Your numbers stay in your browser. Nothing you enter is stored or sent anywhere.
Quick Answer
Example: 1011 + 110 = 10001 in binary — that is 11 + 6 = 17 in decimal. Add column by column from the right; whenever a column reaches 2, write 0 and carry 1, exactly like carrying at 10 in decimal. The calculator above shows the carries, and does the same for subtraction, multiplication and division.
How to Use the Binary Calculator
- Arithmetic: type two binary numbers (only 0s and 1s — spaces are ignored), pick +, −, × or ÷, and read the result in binary, decimal, hex and octal, with the full working underneath.
- Bitwise: the second section lines the numbers up and shows AND, OR and XOR together, plus NOT of the first number at 8, 16, 32 or 64 bits.
- Converter: the third section takes a value in binary, decimal, hex or octal and shows it in all four bases, with its bit length.
- Trust but verify: every arithmetic answer ends with a decimal check line, so you can confirm the binary working against arithmetic you already know.
How Binary Numbers Work
Binary is counting in base 2: only two digits, 0 and 1, and each place is worth twice the place to its right — 1, 2, 4, 8, 16, 32… Reading 101101 from the left: one 32, no 16, one 8, one 4, no 2, one 1 = 45.
| Place | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
|---|---|---|---|---|---|---|---|---|
| Worth | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 101101 | – | – | 1 | 0 | 1 | 1 | 0 | 1 |
Grouping helps humans read long bit strings: bits are written in fours (1111 1111 = 255), each group of four is exactly one hex digit, and each group of three is one octal digit — which is why programmers live in hex. The converter above shows all of these side by side.
Adding and Subtracting in Binary
Addition has only four cases, and two of them are trivial:
| Column | Write | Carry |
|---|---|---|
| 0 + 0 | 0 | 0 |
| 0 + 1 or 1 + 0 | 1 | 0 |
| 1 + 1 | 0 | 1 |
| 1 + 1 + 1 (with a carry) | 1 | 1 |
Subtraction mirrors it with borrowing: when a column asks for 0 − 1, borrow 1 from the next column left — that borrowed 1 is worth 2 in the current column, so 2 − 1 = 1. If the second number is bigger overall, this calculator swaps them, works out the positive difference, and puts a minus sign in front — the way you would on paper. (Computers do it differently, with two's complement — see the card below.)
Multiplying and Dividing in Binary
Multiplication is decimal long multiplication with the world's easiest times table: each partial product is either the number itself (multiplier bit 1) or nothing (bit 0), shifted left by the bit's place. 1011 × 101 has two partial products — 1011 and 101100 — and adding them gives 110111 (55). One shortcut worth knowing: multiplying by 2 is just adding a 0 to the end, exactly like multiplying by 10 in decimal.
Division is repeated compare-and-subtract: walk along the dividend building a running value; whenever it reaches the divisor, write quotient bit 1 and subtract, otherwise write 0. What is left at the end is the remainder: 1101 ÷ 10 = 110 remainder 1, because 13 = 2 × 6 + 1.
Bitwise Operations: AND, OR, XOR and NOT
| Operation | Result bit is 1 when… | 1100 with 1010 |
|---|---|---|
| AND | both bits are 1 | 1000 (8) |
| OR | either bit (or both) is 1 | 1110 (14) |
| XOR | exactly one bit is 1 | 0110 (6) |
| NOT | every bit flips (one number only) | NOT 1100 in 8 bits = 11110011 (243) |
These are the operations processors actually perform, and programmers use them to set, clear, test and toggle individual bits — flags, permissions and masks. NOT is the odd one out: its answer depends on the width, because flipping includes the leading zeros. NOT 1100 is 0011 in 4 bits but 11110011 in 8 bits, which is why the bitwise section asks for a width.
Worked Examples
Example 1 — Addition with carries: 1011 + 110
From the right: 1 + 0 = 1; 1 + 1 = 10 (write 0, carry 1); 0 + 1 + carry 1 = 10 (write 0, carry 1); 1 + 0 + carry 1 = 10 (write 0, carry 1); the last carry becomes a new leading 1 → 10001 (17 = 11 + 6 ✓).
Example 2 — A negative subtraction: 101 − 1101
1101 is larger, so compute 1101 − 101 = 1000 and negate: −1000 (−8 = 5 − 13 ✓).
Example 3 — Big and exact: 11111111 × 11111111
255 × 255 = 65,025 = 1111111000000001. Long bit strings are where ordinary calculators start rounding; this one uses exact integer arithmetic, so every bit is right.
Example 4 — Division with remainder: 1101 ÷ 10
Quotient 110 (6), remainder 1 — 13 ÷ 2 in decimal, exactly the same shape.
Negative Numbers and Two's Complement
A register has a fixed number of bits and no room for a minus sign, so computers store negatives in two's complement: take the positive number, flip every bit, and add 1. In 8 bits, −5 is stored as 11111011 — flip 00000101 to 11111010, add 1, done.
The payoff is that addition just works: −5 + 3 in 8-bit two's complement is 11111011 + 00000011 = 11111110, which reads back as −2, no special subtraction hardware needed. The cost is range: 8 bits hold −128 to 127 signed, versus 0 to 255 unsigned — the same 256 patterns, interpreted two ways.
This page keeps the school convention in its arithmetic (a minus sign in front, like −1000) because that is what homework asks for, and shows two's complement where it belongs: in the converter, for negative decimals, at 8, 16 and 32 bits.
Common Mistakes to Avoid
- Reading 10 as "ten". In binary, 10 is two. Every place is worth twice the previous one, never ten times.
- Forgetting the carry can chain. 1111 + 1 ripples through all four 1s and lands on 10000 — a carry into a column can create the next carry.
- Subtracting the smaller from the larger "per column". Borrowing moves value between columns; if the whole second number is bigger, the answer is negative — swap and negate.
- Confusing XOR with OR. They differ in exactly one case: 1 with 1 gives OR 1 but XOR 0.
- Quoting a NOT without its width. NOT 1100 is 0011, 11110011 or a 64-bit string of 1s ending in 0011 depending on the width — the width is part of the answer.
What This Calculator Does Not Do
- It does not do binary fractions (numbers with a binary point, like 101.11). Whole numbers only — fractional binary needs its own conventions for rounding.
- It does not do arithmetic in two's complement directly — the arithmetic section uses ordinary sign-and-magnitude (a minus sign in front), and two's complement appears as a display in the converter.
- It does not shift or rotate bits (left/right shifts, circular rotates) — the bitwise section covers AND, OR, XOR and NOT.
- Inputs are capped at 128 bits so the step-by-step working stays readable; that is far beyond any register size in normal use.
Frequently Asked Questions
Quick answers about binary arithmetic — adding, subtracting, multiplying and dividing in base 2, bitwise operations, two's complement and bit lengths. Tap a question to open it.
How do you add binary numbers?
Column by column from the right, exactly like decimal addition, with one new rule: 1 + 1 = 10, so you write 0 and carry 1. A column with a carry can total 3 (1 + 1 + 1 = 11: write 1, carry 1). For 1011 + 110 the carries produce 10001, which is 17 — matching 11 + 6 in decimal.
How do you subtract binary numbers?
Column by column from the right, borrowing when a column asks for 0 − 1: the borrowed 1 is worth 2 in its new column, so 2 − 1 = 1. If the second number is larger overall, swap them, subtract, and put a minus sign in front. Computers avoid borrowing altogether by adding in two’s complement instead.
How do you multiply binary numbers?
By shift-and-add. For each 1 in the multiplier, write down the other number shifted left to that bit’s place; 0 bits contribute nothing. Add the partial products. 1011 × 101 gives partial products 1011 and 101100, totalling 110111 — 55, matching 11 × 5.
What happens when you divide binary numbers?
You get a whole-number quotient and a remainder, just like long division in decimal. Walk the dividend building a running value; each time it reaches the divisor, the quotient gains a 1 and the divisor is subtracted. 1101 ÷ 10 = 110 remainder 1, because 13 = 2 × 6 + 1.
What is the difference between XOR and OR?
They agree except when both bits are 1: OR returns 1, XOR returns 0. So 1100 OR 1010 = 1110 (14), but 1100 XOR 1010 = 0110 (6). XOR answers “are these bits different?”; OR answers “is either bit on?”.
How are negative numbers stored in binary?
Usually in two’s complement: flip every bit of the positive number and add 1. In 8 bits, −5 is 11111011. The scheme makes addition work unchanged for negatives, at the cost of range — 8 bits hold −128 to 127 signed instead of 0 to 255 unsigned. The converter above shows the two’s complement form of any negative decimal.
Why do computers use binary?
Because hardware is at its most reliable with two states — a switch off or on, a voltage low or high, a spot magnetised one way or the other. Two digits leave the widest margin for telling signals apart, and Boolean logic (AND, OR, NOT) maps directly onto circuits built from those switches.
How many bits does a number need?
One more than the position of its highest 1 bit. 255 is 11111111, so it needs 8 bits; 256 is 100000000 and needs 9. The converter on this page reports the bit length of any value you enter, in any base.
Can binary numbers have fractions?
Yes — with a binary point. Places to the right are worth 1/2, 1/4, 1/8…, so 0.1 in binary is exactly 1/2 and 101.11 is 5.75. This calculator works with whole numbers only; fractional binary (and its rounding quirks, like 0.1 decimal having no exact binary form) is a topic of its own.
Related Calculators
More free calculators on MyDayCalculator:
- GPA Calculator — weighted averages for school grades.
- Age Calculator — your exact age in years, months and days.
- Scientific Notation Calculator
- Mathematics Calculators
Your privacy: everything you enter stays on your device. The calculator does not store or send your information anywhere.
A quick note: binary is decimal arithmetic with a smaller alphabet — the same carries, borrows and partial products, just triggered sooner. Once 1 + 1 = 10 feels normal, the rest is bookkeeping.
Last reviewed: November 2026.
