alleasycalc
Suggest
Binary Calculator

Binary Calculator

Add, subtract, multiply or divide two binary numbers with the carrying or the quotient and remainder worked out step by step, plus AND, OR, XOR, NOT and a shift on the side. Or convert either way between binary and decimal with the place value worked in full.

What do you want to do
Operation

Binary only uses the digits 0 and 1. Spaces are fine for grouping, such as 1010 1100; anything else is flagged. Each number is capped at 64 digits, plenty for any everyday binary value, to keep the working exact and fast.

What binary numbers actually are

Binary is a counting system with only two digits, 0 and 1, instead of decimal's ten. Computers are built from switches and circuits that are cleanly reliable in exactly two states, a voltage that is on or off, a magnetic patch that points one way or the other, so a number system with only two symbols maps directly onto the hardware with nothing to misread. Decimal needs ten clearly distinguishable voltage levels to represent one digit; binary needs one clearly distinguishable difference, on or off, which is far easier to build billions of and get right every single time. That reliability, not any mathematical superiority, is the entire reason computers count in binary.

Place value: the same idea as decimal, just base two

Every digit in decimal is worth ten times the digit to its right: the 3 in 300 is worth 3 hundreds because the hundreds place is 102. Binary works identically, just with powers of two instead of powers of ten: each position is worth twice the one to its right, and a digit can only be 0 or 1, so a position either contributes its full place value or nothing at all.

binary value = sum of (bit × 2position), counting positions from 0 at the rightmost bit

Take 11010110. Reading its bits against the powers of two 128, 64, 32, 16, 8, 4, 2, 1, the 1 bits sit at 128, 64, 16, 4 and 2, and adding those five numbers, 128 + 64 + 16 + 4 + 2, comes to 214. Nothing about that process is different from decimal place value; only the size of each step changes.

Converting between binary and decimal

Binary to decimal is the sum above: line each 1 bit up with its power of two and add. Decimal to binary runs the opposite direction using repeated division by 2. Divide the number by 2, note the remainder (always 0 or 1), then divide the quotient by 2 again, and keep going until the quotient reaches 0. Reading the remainders from the last one produced back to the first gives the binary number.

214 ÷ 2 = 107 r0 107 ÷ 2 = 53 r1 53 ÷ 2 = 26 r1 26 ÷ 2 = 13 r0 13 ÷ 2 = 6 r1 6 ÷ 2 = 3 r0 3 ÷ 2 = 1 r1 1 ÷ 2 = 0 r1 read upward: 11010110

Both tabs above work through exactly this, one row per step, so the arithmetic is never hidden behind a single instant answer.

Adding and subtracting in binary

Binary addition carries exactly like decimal addition, only a carry fires once a column reaches 2 instead of 10, because 2 is as high as a single binary digit can honestly go. Adding 1011 (11) and 0110 (6) column by column from the right: 1+0=1, no carry; 1+1=10, write 0 and carry 1; 0+1 plus the carried 1 makes 10 again, write 0 and carry 1; 1+0 plus that carry makes 10 once more, write 0 and carry a final 1 out past the last column. The carried-out 1 becomes a new leading bit, giving 10001, which is 17, matching 11 + 6 exactly.

1011 + 0110: carry-in row 1 1 0 0, sum 10001 (17)

Subtraction borrows in the same spirit as decimal subtraction, just borrowing a 2 instead of a 10 whenever a column would need to take 1 away from 0. 1011 (11) minus 0110 (6) borrows once and lands on 0101, which is 5, matching 11 − 6. If the second number is bigger than the first, the true answer is negative, and this calculator says so plainly in decimal rather than inventing an unsigned binary pattern that would not mean what it looked like.

Multiplying and dividing in binary

Binary multiplication works by the same shift-and-add logic as decimal long multiplication, just with only 0 and 1 to multiply by at each step, so every partial product is either the first number, shifted, or a row of zeros. Multiplying is therefore usually built from add and shift circuits rather than a dedicated multiplier table, which is one reason early computers found it comparatively cheap to implement. 101 (5) times 11 (3) comes to 1111, which is 15.

Division in binary produces a quotient and a remainder exactly as decimal division does, and the remainder is always smaller than whatever was being divided by. 1101 (13) divided by 10 (2) gives a quotient of 110 (6) with a remainder of 1, since 6 times 2 is 12 and 13 is one more than that.

Negative numbers, named honestly

Everything above is unsigned binary: every value is zero or positive, with no digit set aside to carry a sign. Real processors do store negative numbers in binary, using a scheme called two's complement: flip every bit of the positive value, then add 1. Flipping 00000110 (positive 6) gives 11111001, and adding 1 gives 11111010, which a processor reading an 8-bit signed value back interprets as −6, recognisable by its leading 1. The scheme is popular mainly because it lets ordinary addition circuits handle subtraction for free, with no separate borrowing logic needed in hardware, but it only works once a fixed bit width is agreed in advance. This calculator does not implement two's complement: every value here is unsigned, which is exactly why a subtraction that goes negative is shown as a plain decimal answer rather than a binary pattern that would need an assumed width to mean anything at all.

Bitwise operations and shifting

AND, OR and XOR compare two binary numbers one bit position at a time. AND gives 1 only when both bits are 1; OR gives 1 when either bit is 1; XOR gives 1 when the bits differ. Comparing 1100 and 1010 bit by bit: AND is 1000, OR is 1110, and XOR is 0110.

AND: 1 only if both bits are 1 · OR: 1 if either bit is 1 · XOR: 1 if the bits differ

NOT flips every bit of a single number, 1 to 0 and 0 to 1, but it only has meaning once a width is fixed, since binary carries no built-in size. This calculator flips exactly the bits typed in for each number, so NOT of 1100 is 0011; typing an extra leading zero first would turn that into NOT of 01100, which is 10011, a genuinely different-looking answer for the same value, simply because the displayed width changed. Shifting is simpler and width-independent in effect: shifting a binary number one place to the left multiplies it by 2, precisely as appending a zero to a decimal number multiplies it by 10, so 101 (5) shifted left becomes 1010 (10). Shifting one place to the right divides by 2 and throws away any remainder, keeping only the whole quotient, and the bit that gets dropped off the end reveals whether the original number was odd or even.

Where binary shows up in real life

File sizes are the everyday brush with binary most people have without realising it. A kilobyte is formally 1,000 bytes and a kibibyte (KiB) is 1,024 bytes, a distinction the IEC standardised in 1998 specifically because binary's powers of two never line up exactly with decimal's powers of ten, which is why a drive marketed in round decimal terabytes always shows a slightly smaller number once an operating system reports it in binary-based units. Network engineers lean on exactly the AND operation described above every time a subnet mask decides which part of an IP address is the network and which is the host, worked through in full on our IP Subnet Calculator. Each hexadecimal digit stands for exactly four binary digits, a nibble, which is why hex numbers so often turn up next to binary ones in programming and colour codes.

Questions people ask

Why do computers use binary instead of decimal?

Because a switch or a circuit is far more reliable at holding two clearly separate states, on or off, than ten finely graded voltage levels. Binary maps directly onto that hardware reality with nothing to misread, which is the whole reason it won out, not any mathematical advantage over decimal.

How do you add two binary numbers by hand?

Add column by column from the right, exactly like decimal addition, except a carry fires once a column reaches 2 rather than 10. 1011 plus 0110 carries three times and lands on 10001, which is 17.

What happens when you subtract a bigger binary number from a smaller one?

The true answer is negative, and this calculator shows that answer honestly in decimal rather than guessing at an unsigned binary pattern. Real computers represent negative binary values with two's complement instead, covered further up this page.

How do you convert a binary number to decimal, and back again?

Binary to decimal sums each 1 bit's power of two. Decimal to binary divides repeatedly by 2 and reads the remainders from the last one back to the first; 214 becomes 11010110 this way.

What is the difference between AND, OR and XOR?

AND gives 1 only when both bits are 1; OR gives 1 when either bit is 1; XOR gives 1 only when the two bits differ. Comparing 1100 and 1010 gives AND 1000, OR 1110 and XOR 0110.

Are negative binary numbers a thing?

Yes, but only once a fixed width and a scheme are agreed, almost always two's complement: flip every bit and add 1. This calculator sticks to unsigned binary and says so plainly whenever an answer would otherwise need a sign.

Why is a kilobyte sometimes 1,000 bytes and sometimes 1,024?

A kilobyte (kB) is formally 1,000 bytes under the decimal SI system, while a kibibyte (KiB) is 1,024 bytes, the nearest binary power of two. Storage is usually marketed in the decimal figure while some operating systems report the binary one, which is why a drive's free space often looks smaller than its advertised size.

Every result here is exact BigInt arithmetic; nothing is rounded. This calculator covers unsigned binary only, up to 64 digits per number, and does not implement two's complement or any other signed representation.

Report a bug

Say what went wrong and where. One sentence is plenty; we read every report.

Embed this calculator

Paste this into your page. The frame sizes itself to fit. Embedding is free while AllEasyCalc grows; the small credit link stays visible.

Email this result

The email comes from AllEasyCalc and carries a link that reopens this calculator with the numbers filled in. One-off, no mailing list.

Suggest a calculator

Name the question you want answered. If it can be worked out, it goes on the build list.