Binary Calculator

Use this binary calculator to add, subtract, multiply, divide, or convert values while checking signed meaning, bit width, and overflow.

Pick Arithmetic to combine two binary numbers, or Conversion to switch between binary and decimal.
Used only in Arithmetic mode. Division returns a quotient and remainder.
In Arithmetic mode, enter a binary number by default. If Conversion mode is set to Decimal to binary, this becomes a decimal input. Spaces, underscores, and 0b prefix can be cleaned automatically.
Used only in Arithmetic mode. Enter the second number to combine with the first.
Used only in Conversion mode.
Advanced options
Format and meaning
Choose Full precision to show all needed bits, or pick a fixed width like 8 or 16 bits to see padding, truncation, and overflow behavior.
Unsigned means all bits count toward a nonnegative value. Signed two's complement lets the leftmost bit act like a sign bit in a standard computer format.
Adds visual spacing to long binary outputs. It does not change the value.
Did we solve your problem today?

How to use our Binary Calculator

  1. Choose What do you want to do: use Arithmetic for two-value math or Conversion to switch between binary and decimal.
  2. If you picked Arithmetic, choose Operation: Add, Subtract, Multiply, or Divide.
  3. Enter First value. In most cases this is binary, but in Conversion mode with Decimal to binary it should be a whole decimal number like -13.
  4. If Arithmetic mode is on, enter Second value. Binary inputs can include spaces, underscores, or a 0b prefix because the calculator cleans them first.
  5. If Conversion mode is on, choose Conversion direction: Binary to decimal or Decimal to binary.
  6. Open Advanced options if needed and set Bit width, Interpretation, and Digit grouping.
  7. Click Calculate to see the Main result, Decimal value, Binary value, and for division the Quotient and Remainder.
  8. Sanity-check the answer: if you use a fixed width, compare Decimal value with Overflow or truncation note to make sure the shown bits still match the meaning you expect.

Definitions

What do you want to do: The main mode. Arithmetic combines two values. Conversion switches between binary and decimal.

Operation: The math action in Arithmetic mode: add, subtract, multiply, or divide.

Bit width: How many bits are kept in the displayed result. A fixed width can add leading zeros or cut off extra bits.

Interpretation: How to read the same bits. Unsigned means only nonnegative values. Signed (two's complement) can represent negative values.

Digit grouping: Visual spacing for long binary answers, such as groups of 4 bits. It does not change the value.

Decimal value: The base-10 meaning of the shown bits under the selected interpretation.

Binary value: The cleaned or computed bit pattern after width and grouping rules are applied.

Quotient: In division, the whole-number result after truncating toward zero.

Remainder: In division, the part left over after subtracting divisor times quotient.

Overflow or truncation note: A message that tells you the exact result did not fit in the chosen fixed width, so the shown bits were wrapped or cut to fit.


Common mistakes and quick fixes

Mistake: Typing letters or digits other than 0 and 1 into First value or Second value for binary input.
Fix: Use only binary digits after cleanup. Spaces, underscores, and 0b are okay, but any other character must be removed.

Mistake: Leaving Second value as 0 when Operation is Divide.
Fix: Enter a nonzero divisor in Second value before you calculate.

Mistake: Entering 10.5 in First value when Conversion direction is Decimal to binary.
Fix: This calculator only accepts whole integers for decimal conversion, so use a value like 10 or -13.

Mistake: Choosing Interpretation as Signed (two's complement) while Bit width is Full precision.
Fix: Pick a fixed width such as 8 bits or 16 bits, because signed two's complement needs a set number of bits.

Mistake: Reading Binary value correctly but forgetting that Decimal value changes when Interpretation changes.
Fix: Check whether you want Unsigned or Signed (two's complement). The same bit pattern can mean different decimal values.

Mistake: Ignoring the Overflow or truncation note when using a small Bit width .
Fix: If the exact answer does not fit, the displayed bits are wrapped to the chosen width. Increase Bit width if you want more of the exact result to show.


Limitations & Key Assumptions / Boundary Conditions

  • This calculator works with integers only. Decimal fractions such as 10.5 are not accepted for Decimal to binary.
  • Signed (two's complement) interpretation requires a fixed Bit width. Full precision does not define one sign bit, so signed reading is not used there.
  • When a fixed width is chosen, results are wrapped modulo 2^n to fit that width. That means the shown Binary value may differ from the full exact result.
  • Overflow or truncation note appears when the exact result cannot fit in the selected width. This is expected behavior for fixed-width arithmetic [1][2].
  • Division uses integer rules only: quotient is truncated toward zero, and remainder is computed from r = a - bq. So division does not return decimals.
  • Very long full-precision outputs may be harder to read even with grouping, though the calculator still keeps the exact integer value.

Methodology

How the calculator reads inputs

Binary entries are cleaned first. Spaces, underscores, and an optional 0b prefix are removed. After that, a binary input must contain only 0 and 1.

If Conversion direction is Decimal to binary, First value must be a whole integer.

Core formulas

unsigned_value = sum(bit_i * 2^i) for i = 0 to n - 1, counting from the right

if msb = 0, signed_value = unsigned_value; if msb = 1, signed_value = unsigned_value - 2^n

wrapped = value mod 2^n

result = a + b, a - b, a * b, or q = trunc(a / b), r = a - b*q

How outputs are built

In Arithmetic mode, the calculator converts the input values to integers first, performs the selected operation, and then formats the answer back into binary. In Conversion mode, it either converts binary to decimal or converts a decimal integer to binary.

If Bit width is Full precision, the calculator shows enough bits to represent the exact non-wrapped result. If a fixed width such as 8 bits is chosen, the calculator stores the result as a wrapped pattern from 0 to 2^n - 1, then displays exactly that many bits.

If Interpretation is Unsigned, Decimal value is the normal nonnegative meaning of the shown bits. If Interpretation is Signed (two's complement), the leftmost bit is treated as the sign bit and the decimal meaning may become negative. Overflow depends on the chosen representation and width [1][2].

Digit grouping only changes spacing for readability. It never changes the stored value.

Mini example

Example: Arithmetic, Add, First value = 1011 and Second value = 110.

1011_2 = 11 and 110_2 = 6

11 + 6 = 17

17_10 = 10001_2

So the calculator shows Main result = 10001 and Decimal value = 17.

Example with fixed width: if you multiply 1111 by 0010 with Bit width = 4, the exact result is 30, which is 11110 in binary.

30 mod 16 = 14

14_10 = 1110_2

The displayed 4-bit pattern becomes 1110, and the calculator adds an Overflow or truncation note because the exact result did not fit [1][2].

Assumptions used

The calculator uses integer arithmetic only, division truncated toward zero, remainder defined as r = a - b*q, and two's complement rules only when a fixed width is selected for signed interpretation.


Sources