How to use the Binary Calculator
- 1
Type the first number
Only 0s and 1s; spaces, underscores and a 0b prefix are allowed. Put a minus sign in front for negatives.
- 2
Choose an operation
Add, subtract, multiply, divide, AND, OR, XOR, shift left or shift right.
- 3
Type the second number
Also in binary — even the shift amount (10 means shift by 2).
- 4
Read three forms
The answer in binary, its decimal and hex values, and the whole sum written in decimal.
Features
Division with remainder
101101 ÷ 1011 gives 100 remainder 1 (45 ÷ 11 = 4 r 1).
Bitwise logic
AND, OR and XOR on any length of bit string.
Shifts
Shift left multiplies by powers of 2; shift right divides and drops the remainder.
Decimal and hex
Every result is converted to base 10 and base 16 (uppercase).
Readable negatives
Negative answers use a minus sign instead of two’s complement bits.
No length limit
BigInt maths keeps long bit strings exact.
Who uses it — and for what
CS students
Check binary arithmetic and logic-gate exercises.
Network learners
AND an IP address with a subnet mask to find the network.
Embedded developers
Test bit masks, flags and register values.
Teachers
Create worked examples with instant answers in three bases.
Binary arithmetic
Binary works like decimal but carries at 2 instead of 10: 1 + 1 = 10 (two), and 1 + 1 + 1 = 11 (three). 101101 (45) + 1011 (11) = 111000 (56). Subtraction borrows 2, multiplication is shifting and adding, and division gives a quotient plus remainder in binary. Negative results are shown with a minus sign rather than in two’s complement so they’re easy to read.
Bitwise operations
AND keeps a bit only where both numbers have a 1, OR where either has a 1, and XOR where exactly one has a 1. Shifting left by n multiplies by 2ⁿ; shifting right divides by 2ⁿ and drops the remainder. Bitwise operations are used for permission flags (like Unix chmod), network subnet masks, graphics, compression and checksums. All calculations use exact big integers, so long binary strings never lose precision.
Every result is calculated in your browser the moment you type, so you can change a number and see the effect instantly — ideal for checking homework, worksheets and exam practice. Results are shown to a sensible number of decimal places; very large or tiny values switch to scientific notation.
Step-by-step: column addition and long multiplication in binary
Add 101101 (45) and 1011 (11) the way you would on paper, right to left. The only facts you need are 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11 (write 1, carry 1).
carries 1 1 1 1
1 0 1 1 0 1
+ 0 0 1 0 1 1
---------------
1 1 1 0 0 0The answer 111000 is 32 + 16 + 8 = 56, matching 45 + 11. Multiplication is even simpler, because each digit of the multiplier is either 0 (write a row of zeros) or 1 (copy the number shifted left). For 110 × 101: write 110, skip the middle 0, write 110 shifted two places (11000), then add: 110 + 11000 = 11110, which is 30 = 6 × 5.
Two’s complement, done by hand
Computers store negatives in two’s complement, which this tool deliberately does not display. To write −34 in 8 bits: take 34 = 00100010, flip every bit (11011101), then add 1 → 11011110. As an unsigned number that is 222, and 222 = 256 − 34. Check it here: 100000000 − 100010 = 11011110.
Pitfalls to watch for
- The shift amount is binary too. “1011 << 10” shifts by two places, not ten, giving 101100 (44). Type 1010 if you really mean ten.
- Digits other than 0 and 1. Entering 102 gives “Use only 0 and 1”. Convert decimal or hex values first with the Number Base Converter.
- Division throws away the fraction. The quotient is a whole number and the remainder is shown separately; there is no binary point.
- Bitwise operations on negative numbers. Internally, negative values behave as if they had infinitely many leading 1s (two’s complement). So −101 AND 11 gives 11 (−5 & 3 = 3), and −101 shifted right by 1 gives −11 (−3, rounding down). This matches most programming languages but can surprise people expecting simple sign-and-magnitude logic.
- Fixed-width overflow is not simulated. Real 8-, 16- or 32-bit registers wrap round; here numbers simply grow. AND the result with a mask of 1s (11111111 for 8 bits) to see what a fixed-width register would keep.
Where bit-level arithmetic matters
File permissions in Linux are three groups of three bits — see the Chmod Calculator. Subnetting is AND with a mask, explored fully in the IP Subnet Calculator. Graphics code packs red, green and blue into one number with shifts and ORs; game engines store dozens of on/off flags in a single integer; compression and error-detection codes (parity bits, CRCs) are built from XOR. Learning to read a few lines of binary arithmetic makes all of these far less mysterious.
Worked examples
Overflow into a ninth bit
1111 1111 + 1 → 100000000 (decimal 256, hex 100). An 8-bit register holding 255 would wrap round to 0 here; the calculator shows the full answer, so you can see the carry that would be lost.
Finding a network address
192.168.1.100 in binary is 11000000101010000000000101100100; mask 255.255.255.0 is 11111111111111111111111100000000. AND gives 11000000101010000000000100000000 = hex C0A80100, which is 192.168.1.0 — the network address.
Toggling bits with XOR
11111111 XOR 10101010 → 1010101 (85, hex 55). Every bit that was 1 in the mask has been flipped. XOR the result with the same mask again and you get 11111111 back, which is why XOR is used in simple ciphers and checksums.
Pro tips
- Shift left by n is a fast multiply by 2ⁿ; shift right by n is a divide by 2ⁿ that rounds down.
- A number is odd exactly when its last bit is 1 — AND it with 1 to test.
- Group long bit strings in fours with spaces; they are ignored, and each group maps to one hex digit.
Glossary
- Bit
- A single binary digit, 0 or 1.
- Bit mask
- A binary pattern used with AND, OR or XOR to pick out, set or flip particular bits.
- Two’s complement
- The usual way computers store negative integers: flip all bits of the positive value and add 1.
- Overflow
- When a result needs more bits than a fixed-size register has, so the top bits are lost.
Frequently asked questions
What is 1 + 1 in binary?
10.
How do I convert binary to decimal?
Each digit is a power of two; the result row shows the decimal value.
Are spaces allowed in the numbers?
Yes, spaces and underscores are ignored.
How is division handled?
It is integer division: the quotient is rounded towards zero and the remainder is shown in binary after the result, for example 100 remainder 1.
Can I enter hexadecimal?
No — both inputs must be binary. The result is shown in hex, and the Number Base Converter can turn hex into binary first.
Why is the shift limited to 4,096?
Shifting left by a huge amount creates an enormous number; the limit keeps the page fast.
Last updated 2026-11-28 · Built by Vinayak Agarwal · Part of Math & Science (42 tools)