Binary Calculator

Computers count in base two, and sometimes their humans must too. Enter two binary numbers, choose the operation, and this calculator returns the result in binary and decimal — subnetting, flags and bit arithmetic without the manual conversion errors.







Arithmetic With Two Digits

Binary is the decimal system rebuilt from two symbols instead of ten: place values double instead of decupling (…16, 8, 4, 2, 1), carries trip at two instead of ten, and the multiplication table shrinks to a single fact (1 × 1 = 1) — the arithmetic a transistor can be trusted with. The operations themselves are the school algorithms in miniature: addition aligns and carries (1 + 1 = 10, write 0 carry 1 — the half-adder's whole personality), multiplication is shift-and-add, and every higher operation decomposes into those two. This calculator performs the honest three-step any audit requires — interpret both operands as the integers they denote, compute in the ordinary way, re-express — and prints the decimal line beside the binary one so the reader can check the base-two work against their native intuition. Its precision note (exact integers fade past about 253, with practical binary strings far shorter) is printed because registers are finite in machines and in widgets alike. Read the four operations as a ladder of cost, incidentally: addition is a single pass of carries, multiplication is additions in procession, division is the expensive, iterative one — chip architects budget silicon accordingly, and the calculator's instant answers conceal a hardware truth (a divider is a neighbourhood, an adder a street) that anyone who has priced processors has paid for without seeing.

Worked Example: 1010 + 1100

The defaults add ten and twelve in their binary dress: 10102 (8 + 2) and 11002 (8 + 4). Aligned and carried — the 2s column: 1 + 0 = 1; the 4s: 0 + 1 = 1; the 8s: 1 + 1 = 10, write 0 carry 1 into the 16s — the result is 101102, and the decimal line confirms: 10 + 12 = 22, which is 16 + 4 + 2, exactly the bits set in 10110. The other operations on the same pair are the reader's to run: subtraction yields −102 (negative, because 1010 is the smaller — the widget renders the sign honestly rather than wrapping into two's complement, and says so here because machine registers DO wrap, a divergence between mathematical and machine arithmetic worth one clear sentence), multiplication 11110002 (120), division the integer 0 with the smaller divided by the larger.

Where Binary Arithmetic Earns Its Keep

Nobody adds binary for pleasure at scale — machines do it billions of times a second — but the humans who configure the machines live in it daily: network engineers subnetting addresses (a /26 mask is a binary boundary), programmers reasoning about permission flags and bitfields (each flag one bit, combined by exactly this addition's cousin OR), embedded developers reading registers, and students whose examinations demand the manual skill the calculator checks. The page's value is the audit trail: homework verified, a mask computation cross-checked, a flag combination confirmed before it ships. The subnetting case repays a sentence of its own: a /26 network borrows two bits from the host portion of the final octet, and the subnet count (4), block size (64) and host count (62) that examiners demand are each this page's binary arithmetic in uniform — powers of two, stepped through the octet's binary boundaries. Its decimal companion line is the professional's habit — never trust a base conversion you have not sanity-checked in the base you think in — embedded in the tool itself.

The Overflow Parable

Every finite register keeps a parable: add 1 to the largest value an n-bit unsigned counter holds and it wraps to zero — the odometer's treason, behind a famous family of software disasters from hour-counter resets to a very expensive rocket's guidance failure in 1996, when a 64-bit float's conversion into a 16-bit integer overflowed thirty-seven seconds into flight. The calculator, unbounded in width, cannot overflow at its readers' scales; the parable is printed so the reader understands why their machine's arithmetic can — width is a physical property of registers, invisible in mathematical notation, and the whole of embedded engineering is the discipline of remembering it. Binary is exact about everything except how much of it you kept.

Related Tools

More from the Math Calculators hub: the Adding Fractions Calculator — the other arithmetic where the representation fights back — and the Standard Form Calculator, for numbers too long for any base's patience.

Frequently Asked Questions

How do I convert binary to decimal by hand?

Sum the place values where the bits are 1: 10110 is 16 + 4 + 2 = 22, reading the places right to left as 1, 2, 4, 8, 16. The reverse — decimal to binary — is repeated halving with remainders, or greedy subtraction of the largest power of two that fits. The calculator's decimal line performs the first; a reader who can do both directions on four bits owns the concept, and the machine's work on forty bits becomes legible rather than magical.

What is two's complement, and why doesn't the calculator use it?

Two's complement is the machine encoding for signed numbers: in a fixed width (say 8 bits), negatives are stored as 256 minus their magnitude, so 1010 − 1100 in an 8-bit register wraps to 11111110, meaning −2 — the width is the meaning. The calculator reports mathematical integers with an honest minus sign instead, because its readers are checking arithmetic, not register contents; conflating the two is a classic source of confusion, and the page's worked example flags the divergence explicitly so a reader meeting the wrapped form in a debugger recognises it as the same answer in machine dress.

Why does division say 'integer'?

Because binary fractions are a second topic (with their own famous pathology — 0.1 decimal has no finite binary form, the root of a thousand floating-point surprises), and this page's division is the integer operation: quotient only, remainder discarded, exactly as CPUs perform it. A reader needing the remainder can recover it from the printed decimal line (dividend − quotient × divisor), and a reader needing fractional binary should meet it as its own subject rather than as a silent extension of this one. The label states the scope; the scope is honest.

How large can the inputs be?

The arithmetic runs on the machine's exact integers, safe to 253 − 1 — far beyond any hand-checking purpose — though the note's caution about long strings refers to readability as much as range: binary notation is prolix (a million needs twenty digits), which is precisely why hexadecimal exists as binary's shorthand, four bits per digit. The hub's conversion pages handle the bases' diplomacy; this page keeps the arithmetic itself in the base the reader asked about, unabbreviated.

What are bits, bytes and words in this light?

A bit is one binary digit — one place in these numbers — a byte is eight of them (values 0–255, the calculator's playground at three digits of decimal), and a word is the machine's native width (32 or 64 bits in current practice). The file sizes, colour depths and address spaces of computing are all counts in these units, and their arithmetic is this page's: a 32-bit address space is 232 addresses because each of 32 binary places doubles the count — the exponential hiding inside every "32-bit" label ever printed.

How do I subtract in binary by hand?

By the borrowing you know from decimal, at base two: subtract columnwise right to left, and when a column needs more than it holds, borrow a 1 from the next column left — worth two in the borrowing column (as a borrowed ten is worth ten in decimal). 1100 − 1010 runs: ones, 0 − 0 = 0; twos, 0 − 1 must borrow, becoming 2 − 1 = 1, the fours column repaying the loan; fours, now 0 − 0 = 0; eights, 1 − 1 = 0 — answer 102, the 2 the decimal line confirms (12 − 10). Machines skip the borrowing entirely via two's complement addition, which is why the complement exists; humans checking registers borrow, as above, and check against this page.

What is hexadecimal, and why do programmers prefer it?

Base sixteen — digits 0–9 then A–F — adopted because one hex digit is exactly four binary digits, so byte values compress from eight characters to two (11111111 is FF) with conversion a mechanical grouping, no arithmetic required. Colour codes, memory addresses and MAC numbers all speak hex for this reason: it is binary in a trench coat, readable at human speed, lossless in both directions. This page stays in binary because the arithmetic instruction lives there; the hub's conversion pages handle the hex shuttle for readers whose work lives at the boundary.

Who invented binary arithmetic?

Leibniz published it in 1703 (Explication de l'arithmétique binaire), saw in it a metaphysics of creation from nothing and unity, and learned afterwards that the I Ching's hexagrams had encoded the same counting for millennia. Pingala's prosody in ancient India enumerated binary patterns earlier still. The modern reign begins with Shannon's 1937 insight that Boolean algebra and switching circuits are the same thing — the thesis that put Leibniz's meditation into every machine on earth, and this page's operations into their native habitat.