Binary Calculator

Part of Math & Statistics Calculators

Perform arithmetic operations on binary numbers: addition, subtraction, multiplication, and division.

Enter binary digits (0 and 1 only)
Enter binary digits (0 and 1 only)

What is Binary?

Binary is a base-2 number system that uses only two digits: 0 and 1. Unlike the decimal system we use daily (base-10), which has ten digits (0-9), binary represents all numbers using combinations of just zeros and ones. Each binary digit is called a "bit," and in a binary number, each position represents a power of 2, just as each position in decimal represents a power of 10.

For example, the binary number 1011 equals (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰) = 8 + 0 + 2 + 1 = 11 in decimal. Binary is fundamental to computer science because digital circuits can easily represent two states: on (1) or off (0), making it the natural language of computers.

Binary Arithmetic Operations

Binary Addition: Add binary numbers column by column from right to left, just like decimal addition. The rules are: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (0 with a carry of 1), and 1+1+1=11 (1 with a carry of 1).

Binary Subtraction: Subtract binary numbers column by column. The rules are: 0-0=0, 1-0=1, 1-1=0, and 10-1=1 (borrow from the next column when needed).

Binary Multiplication: Multiply as in decimal, but using binary rules: 0×0=0, 0×1=0, 1×0=0, 1×1=1. Multiply each digit and add the partial products.

Binary Division: Divide similarly to decimal long division. Determine how many times the divisor fits into the dividend, subtract, bring down the next digit, and repeat.

How to Use This Binary Calculator

  1. Enter first binary number: Type a sequence of 0s and 1s in the first input field. No spaces or other characters.
  2. Enter second binary number: Type another binary number in the second input field.
  3. Select operation: Click one of the four operation buttons: Add, Subtract, Multiply, or Divide.
  4. Calculate: Click the "Calculate" button to perform the operation.
  5. View results: See the binary result along with decimal and hexadecimal conversions for easy verification.

Binary Number Conversions

Binary to Decimal: Multiply each bit by its corresponding power of 2 and sum the results. For example, 1101₂ = (1×8) + (1×4) + (0×2) + (1×1) = 13₁₀.

Decimal to Binary: Repeatedly divide the decimal number by 2 and record the remainders in reverse order. For example, 13÷2=6 R1, 6÷2=3 R0, 3÷2=1 R1, 1÷2=0 R1, giving 1101₂.

Binary to Hexadecimal: Group binary digits in sets of four from right to left, then convert each group to its hexadecimal equivalent (0-9, A-F). For example, 11010110₂ = 1101 0110₂ = D6₁₆.

Why Binary Matters in Computing

Every piece of data in a computer—text, images, videos, programs—is ultimately stored and processed as binary numbers. A transistor in a computer chip is either on or off, representing 1 or 0. Modern processors perform billions of binary operations per second, executing complex calculations by breaking them down into simple binary arithmetic.

Understanding binary is essential for low-level programming, network engineering, and computer architecture. Binary operations are used in bitwise manipulation, data compression, encryption, and graphics processing. When you see file sizes measured in kilobytes or megabytes, those are ultimately counts of binary digits (bits).

Common Binary Values

Powers of 2: 1 (2⁰), 10 (2¹), 100 (2²), 1000 (2³), 10000 (2⁴), 100000 (2⁵), 1000000 (2⁶), 10000000 (2⁷), 100000000 (2⁸)

In decimal: 1, 2, 4, 8, 16, 32, 64, 128, 256 respectively

Byte values: A byte is 8 bits. The range is 00000000 to 11111111 in binary, or 0 to 255 in decimal.

Bitwise Operations in Programming

Most programming languages support direct binary operations through bitwise operators. Common operators include AND (&), OR (|), XOR (^), NOT (~), left shift (<<), and right shift (>>). These operations work directly on the binary representation of numbers and are extremely fast, making them valuable for optimization.

For example, multiplying by 2 can be done with a left shift: 5 << 1 equals 10. Checking if a number is even can be done with AND: n & 1 returns 0 for even numbers. These bitwise tricks are commonly used in graphics programming, cryptography, and data compression.

Signed Binary Numbers

This calculator works with unsigned (positive only) binary numbers. In computer systems, negative numbers are often represented using two's complement notation, where the leftmost bit indicates the sign. Two's complement allows computers to use the same circuitry for addition and subtraction, simplifying processor design. Understanding signed binary representation is crucial for systems programming and understanding integer overflow behavior.

For hexadecimal calculations, use the Hex Calculator. Binary uses powers of 2 - see the Exponent Calculator for power calculations. The Logarithm Calculator can help with log base 2 computations.