Binary Calculator

This free online binary calculator adds, subtracts, multiplies, and divides two binary numbers, showing the result in both binary and decimal. It's useful for students, programmers, and anyone working with base-2 arithmetic.


How to Use the Binary Calculator

  1. Enter a binary value (only 0s and 1s) in the "Binary Number 1" field.
  2. Select an operation: addition (+), subtraction (−), multiplication (×), or division (÷).
  3. Enter the second binary value in the "Binary Number 2" field.
  4. Click "Calculate" to see the result in both binary and decimal, plus a remainder for division.

Reading a Binary Number

Binary is base 2, so each position is worth twice the one to its right: 1, 2, 4, 8, 16, 32 and so on, reading from right to left. To convert to decimal, add the place values wherever there is a 1. For 1101, that is 8 + 4 + 0 + 1 = 13. Leading zeros change nothing, so 0011 and 11 are both 3.

BinaryDecimalBinaryDecimal
0001110019
00102101010
00113101111
01004110012
01015110113
01106111014
01117111115
100081000016

Doing Binary Arithmetic by Hand

You can check the calculator's answers with the same column method used for decimal sums. Only four addition facts are needed: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1), and 1 + 1 + 1 = 11 (write 1, carry 1).

  • Addition: 1011 + 0110. Working from the right: 1 + 0 = 1; 1 + 1 = 0 carry 1; 0 + 1 + 1 = 0 carry 1; 1 + 0 + 1 = 0 carry 1; the final carry gives 10001. In decimal, 11 + 6 = 17.
  • Multiplication: 101 × 11. Multiplying by 1 copies the number and multiplying by 0 gives zeros, so write 101, then 101 shifted one place left (1010), and add them: 101 + 1010 = 1111. In decimal, 5 × 3 = 15.
  • Division: 1101 ÷ 0011 gives 100 with remainder 1, the same as 13 ÷ 3 = 4 remainder 1. The calculator always does whole-number division and shows the remainder separately, because binary fractions are outside its scope.

Negative Results and Two's Complement

If the second number is larger than the first in a subtraction, the result is negative and the calculator shows it with a minus sign: 0011 − 1010 gives −111 (−7). Computers do not store a minus sign. They usually use two's complement, where in an 8-bit byte −7 is stored as 11111001 (invert every bit of 00000111 and add 1). If your coursework or code expects two's complement, convert the magnitude shown here in that way, using the bit width your problem specifies.

Where Binary Arithmetic Comes Up

  • Computer science courses, where students add and subtract binary numbers before learning about logic gates and adders.
  • Networking, where IPv4 subnet masks are 32-bit binary numbers. A /24 mask is twenty-four 1s followed by eight 0s, written 255.255.255.0 in decimal.
  • Embedded programming, where register values and flags are often read bit by bit.
  • Checking overflow: adding 11111111 and 1 gives 100000000 (256), which needs nine bits. In an 8-bit register the ninth bit would be lost and the stored result would wrap round to 0.

Frequently Asked Questions

It parses both binary strings into decimal numbers, performs the selected operation on the decimal values, then converts the result back to binary. For example, 1010 (10) + 0011 (3) = 1101 (13).

Only strings made up entirely of 0s and 1s are valid. Any other character, or an empty field, triggers "Invalid input! Please enter valid binary numbers (only 0s and 1s)."

Division by zero is not allowed, so if Binary Number 2 evaluates to 0 the calculator shows "Invalid input! Division by zero is not allowed." instead of a result.

The calculator converts your input to a standard JavaScript number, which holds whole numbers exactly up to 2^53. That means inputs and results of up to 53 binary digits are exact. Beyond that, the lowest bits may be rounded, so split very long values into smaller parts or use a programming tool that supports big integers.

Two's complement depends on a fixed bit width, such as 8, 16 or 32 bits, and the same negative number looks different in each. The calculator does not know which width you need, so it shows the plain signed value, for example −111 for −7. You can convert that to two's complement for your chosen width by inverting the bits and adding 1.
No ratings yet — be the first!
Rate this calculator:
Was this tool helpful?