Binary Calculator
Binary arithmetic, bitwise AND/OR/XOR/NOT/shift, and an interactive two's complement bit grid โ with decimal and hex shown alongside every result, across 8, 16 or 32-bit widths.
โก Quick Tips for Binary Arithmetic and Bitwise Logic
Features
Add, subtract, multiply and divide with explicit overflow detection for the selected bit width.
AND, OR, XOR, NOT and left/right shift, with a bit-by-bit visual comparison of every operand.
Click individual bits or type a decimal value โ both stay in sync instantly.
Switch bit width in one click; range limits and overflow checks update to match.
Every result appears in binary, decimal and hexadecimal simultaneously, no extra step.
Every result shows the exact calculation used, from raw arithmetic to overflow wraparound.
Three Genuinely Different Binary Questions
"Binary calculator" search results mostly return the same tool wearing different skins: two numerator fields, an operator picker, and a decimal answer. That covers arithmetic, but it skips two entire categories of binary work that programmers and students hit constantly โ bitwise logic (masking, flag-setting, fast multiplication via shifts) and signed-number representation (how a processor actually stores โ42 using only 0s and 1s). This tool treats all three as first-class modes rather than bolting bitwise operations on as an afterthought, sharing the same bit-width selector and the same binary/decimal/hex output across all of them.
Overflow Is a Feature Here, Not a Bug to Hide
A fixed bit width has a hard ceiling โ an 8-bit unsigned register can only hold 0 to 255, full stop. Add 200 and 100 in that width and the true sum, 300, simply doesn't fit; real hardware wraps it around to 44 (300 โ 256) and moves on without complaint, which is exactly the mechanism behind classic integer-overflow bugs in real software. Rather than silently doing the same wraparound and leaving you to wonder why the number looks wrong, this calculator shows both numbers explicitly โ the true mathematical result and the wrapped value a real register would store โ with a clear warning flagging that overflow actually occurred.
Reading Two's Complement Without Memorizing a Trick
"Invert the bits and add one" is the standard recipe for two's complement, but it's easy to apply mechanically without understanding why it works. The real idea: in an n-bit signed number, the leftmost bit is assigned a negative place value of โ2โฟโปยน instead of the usual positive one. Everything else works exactly like ordinary binary. So 11010110 in 8 bits is โ128 + 64 + 16 + 4 + 2 = โ42 โ no inversion step required if you just treat the top bit's place value as negative from the start. The clickable bit grid in this calculator's Two's Complement mode makes that place-value relationship tangible: flip the top bit and watch the signed value jump by exactly 2โฟโปยน.
Who Actually Reaches for a Binary Calculator
Computer science students working through binary arithmetic, two's complement, and bitwise-operation homework where a wrong answer is often one flipped bit away from a right one. Self-taught and bootcamp programmers building intuition for bit masks, flags, and why shifting is faster than multiplying, before those concepts show up unexplained in real code. Embedded and low-level developers double-checking a register value or a bitmask calculation by hand, away from a full IDE or debugger. Digital logic and computer architecture students connecting binary arithmetic to the adder and logic-gate circuits it's built from. For the combinatorics side of computer science coursework โ permutations, combinations, and probability โ the Probability Calculator and Permutation & Combination Calculator cover that adjacent ground.
Two Calculations Worth Walking Through
Overflow in action: in 8-bit unsigned mode, add 11111111 (255) and 00000001 (1). The true sum is 256, which doesn't exist in 8 bits โ the calculator flags the overflow and shows the wrapped result as 00000000 (0), the exact "counter rolls over to zero" behaviour that causes real bugs in fixed-width counters and checksums.
Masking a byte: take binary 10110110 and AND it with 00001111 in Bitwise mode. The result is 00000110 โ every bit from the upper nibble gets zeroed out regardless of what it was, while the lower nibble passes through unchanged. This exact pattern is how real code isolates a specific range of bits out of a larger value, like reading just the low byte of a 16-bit color value.
Where Binary Math Actually Shows Up in Real Systems
An RGB color like #3C8AE0 is three 8-bit values packed side by side โ 0x3C, 0x8A and 0xE0 โ and extracting just the green channel from a single packed 24-bit integer is a right-shift followed by an AND mask, exactly the two Bitwise mode operations this calculator handles directly. File permission systems (Unix's rwx flags) are a set of individual bits combined with OR to grant permissions and AND with a NOT-mask to revoke them, which is why permission values like 755 map cleanly onto binary flag patterns once you see them in base 2 instead of octal. Network subnet masks work the same way โ ANDing an IP address with a mask determines which addresses belong to the same network, a calculation that's genuinely just bitwise AND underneath the networking terminology. None of these are abstract textbook exercises; they're the same three or four bitwise operations this tool computes, just wearing a different domain's vocabulary.
Why Browser-Based Beats Mental Bit-Flipping
Manually inverting 32 bits and adding 1 to check a two's complement conversion is slow and genuinely error-prone โ miss one flipped bit and the whole answer is wrong with no obvious sign anything went awry. This tool computes every conversion, arithmetic operation and bitwise result exactly, instantly, and shows the formula alongside the answer so it works as a way to check your own hand-worked homework rather than just replacing the learning. Nothing you enter is sent anywhere โ every calculation runs client-side in JavaScript.
Where This Calculator Stops
It's built for exact integer binary math at 8, 16 and 32-bit widths โ it doesn't handle binary floating-point representation (IEEE 754), arbitrary-precision 64-bit-and-beyond arithmetic, or binary-coded decimal. If you need to simply convert a number between binary, decimal, octal and hex without any arithmetic attached, the Number Base Converter is a faster, more direct tool for that single job. And if your actual task is converting readable text to and from binary character codes rather than doing math on binary numbers, that's a text-encoding problem, not an arithmetic one โ a dedicated text-to-binary converter handles that correctly.