Binary Calculator
Add, subtract, multiply, and divide two binary numbers, or run bitwise AND, OR, XOR, and shifts. Every result shows its decimal and hex equivalents, with exact BigInt math.
- Free, no account
- No watermark
- No usage limit
About the Binary Calculator
Most binary calculators will hand you a wrong answer eventually and never say so. The failure is quiet: they run on 64-bit floating point, so once your numbers climb past about 9 quadrillion (2 to the 53rd power), whole values start rounding and the output drifts off the real total with no warning at all. This calculator can't drift like that, because it does exact math on BigInt. No size ceiling, no rounding, and a four-bit nibble takes the exact same path as a 300-bit value. Type 1010, type 0110, hit add, you get 10000, which is 16.
The other thing it does on every result: it shows the decimal and hex right beside the binary. Binary is honest but hard to read, nobody parses 10011010010 in one look, so seeing "that's 1234" next to the bits is usually the answer you actually came for. Arithmetic (add, subtract, multiply, divide) and the bitwise operations (AND, OR, XOR, NOT, left and right shift) are both here, split into two groups in the menu. Everything runs in your browser, and once the page loads it keeps working with the network off. Nothing you type leaves the machine.
How to use
- Type your first binary number up top, just 0s and 1s. Group the bits with spaces if it helps you read them (
1010 0110), the spaces get stripped before the math. Once it's valid you'll see the decimal value appear underneath, so you can sanity-check what you entered. - Pick an operation. Arithmetic holds add, subtract, multiply, and divide. Bitwise holds AND, OR, XOR, NOT, and the two shifts.
- Enter the second value. For most operations that's a second binary number. For a shift it's a count, how many places to move the bits, so
10there means shift by two places, not shift by the value ten. Choose NOT and the second field disappears, because NOT works on a single number. - Read off the result. Binary in big bold type, decimal and hex beside it. Division also shows the remainder in binary and decimal, since integer division rarely lands even.
- There's no Calculate button anywhere. Edit a bit or switch the operation and the answer updates as you go.
Type something that isn't binary, an 8 or a stray letter, and the field turns red and tells you what's allowed instead of guessing at what you meant. Ask it to divide by zero and you get a plain "you can't divide by zero," not a NaN and not a crash.
The bitwise half, what a plain calculator won't do
Arithmetic treats the number as one quantity. Bitwise operations treat it as a row of independent switches and act on each bit on its own, and that's the real reason programmers keep binary close. Each one lines the two values up column by column and applies a single rule.
AND returns a 1 only where both inputs have a 1. So 1010 AND 0110 is 0010 (2), just the one column they share. This is how masking works: AND against a value that has a 1 in a single spot, and you find out whether that one flag is set.
OR returns a 1 where either side has a 1, so 1010 OR 0110 is 1110 (14). That's how you force a bit on regardless of what it was.
XOR returns a 1 only where the two differ. 1010 XOR 0110 is 1100 (12). XOR has a trick worth keeping in your back pocket: apply the same value twice and you land back on the original, which is why it turns up in cheap ciphers, checksums, and the swap-two-variables-without-a-spare-slot move.
Shifts slide every bit sideways. A left shift by one tacks a zero on the right and doubles the number (1010 << 1 is 10100). A right shift drops the rightmost bit and halves it, rounding down. Shifting is how a processor multiplies or divides by powers of two, which is why you'll spot x << 3 in code where a person would just write times eight.
Negatives, and why NOT comes out below zero
The honesty matters most with negatives. Flip every bit of 1010 (that's 10) and you might expect a neat 0101. The Binary field gives you -1011 instead, which is -11 in decimal, and that's not a bug. On real hardware, using two's complement, flipping all the bits of a number n produces -(n + 1), because the sign lives in the top bit, so the instant you flip them the number reads as negative. This calculator reports that real result rather than a tidy-looking fake, so what you see matches what a CPU would actually do with those bits.
Negatives themselves show as sign-and-magnitude here: the tool works out the size, then sets a minus in front, so -4 displays as -100. That's the right shape for doing arithmetic and for writing number literals in code. But no mainstream processor stores negatives that way. Hardware uses two's complement, where there's no separate minus at all, the leftmost bit is the sign. In one byte, -1 is 11111111. Read those same eight bits as unsigned and they say 255.
And that is exactly where a general binary calculator has to stop short. Pull 11111111 out of a byte and it's 255 or it's -1, nothing in the bits alone decides which, you need the width and whether it's signed. Some tools paper over that by assuming 8-bit or 32-bit and printing a confident two's-complement answer, which is really just a guess. This one won't guess your register width for you. If you specifically need fixed-width wraparound, an 8-bit or 32-bit programmer's calculator (Windows Calculator's programmer mode, for one) is the right pick, because there the width is a thing you set on purpose.
If you spend more time hopping between bases than doing math on them, the number base converter lays binary, octal, decimal, and hex out side by side.
Frequently asked questions
Does the remainder mean I did the division wrong?
No, that's just what integer division does. This tool divides whole numbers and stops at the whole-number quotient, so anything left over comes back as the remainder. Divide 1010 (10) by 11 (3) and you get quotient 11 (3) with remainder 1, because 3 goes into 10 three times with 1 to spare. If you were after a fractional answer like 3.33, that's a different kind of math (see the binary-fractions question below).
What does the hex column give me that decimal doesn't?
Hex is the compact way to read the bits. One hex digit stands for exactly four bits, so a 32-bit value fits in eight hex characters instead of thirty-two ones and zeros. Checking a color channel, a memory address, or a bitmask, hex maps onto the bit pattern far more cleanly than decimal, and it's the form you'll meet in most code and debuggers. Decimal gives you a number you have a feel for, hex is the quick way to read the underlying pattern itself.
Can I paste a really long binary string?
Yes, as long as you like. There's no length cap because the math runs on BigInt, which handles whole numbers of any size exactly. A 256-bit value and a 4-bit value run through identical code and both come out precise. Spaces in a pasted string are fine too, they're stripped before anything is computed, so grouped input like 1111 0000 1010 works with no cleanup on your end.
Why is my shift result off by way more than expected?
Almost always because the shift box is a count, not a value. It reads what you type as binary, so 100 in there means shift by four places, not shift by one hundred. Four places multiplies (or divides) by 16, which is a big jump if you meant to move by one. When a shift looks wildly wrong, check that the number in the shift box is the number of places you actually intended.
Does it handle subtraction that drops below zero?
It does. Subtract a bigger number from a smaller one and you get a negative, shown with a leading minus, so 0110 - 1010 comes out -100 (that's -4). Same goes for any operation whose true result is negative. The value stays exact either way, the minus sign is only how it's displayed on screen.
Is anything I type sent anywhere?
No. Every calculation happens locally with plain JavaScript, there's no server call and nothing gets logged or stored. You can open the network tab and watch it stay quiet while you work. That's also why the tool keeps calculating after you drop the connection, once the page has loaded it doesn't need one.