Skip to content
Popular Calculators
Browse Math calculators

Binary Calculator

Add, subtract, multiply and divide binary numbers, apply bitwise operations and shifts, and convert to decimal and hex.

What do you want to work out?

Only 0 and 1. Spaces and underscores are ignored, so 1010 1010 is fine.

About the Binary Calculator

Binary is counting with two digits instead of ten. That is the entire difference, and everything else follows from it.

A computer uses binary not because it is elegant but because it is robust. A circuit can reliably distinguish "current flowing" from "current not flowing"; it cannot reliably distinguish ten different voltage levels at a billion times a second. Two states are cheap, fast and hard to get wrong, so every layer above — arithmetic, text, images, this page — is built on top of them.

This calculator does arithmetic in binary with the carries shown, applies the bitwise operations, shifts, and converts to decimal and hex.

How to Use the Binary Calculator

Arithmetic adds, subtracts, multiplies or divides two binary numbers, and shows the column working for addition.

Bitwise applies AND, OR or XOR, comparing the numbers one bit at a time.

Shift moves the bits left or right, which multiplies or divides by powers of two.

Convert and inspect gives the decimal and hex equivalents, the place values, and the fixed-width forms.

Spaces and underscores are ignored, so 1010 1010 and 1010_1010 both work.

Counting in Binary

Each place is worth twice the one to its right:

  place:   128   64   32   16    8    4    2    1
  bits:      1    1    1    1    1    1    1    1   =  255
  bits:      0    0    0    1    1    0    1    1   =   27

So 11011 is 16 + 8 + 2 + 1 = 27. Reading binary is just adding the place values where there is a 1.

Counting up looks unfamiliar only because the carries come so often:

  0, 1, 10, 11, 100, 101, 110, 111, 1000, …
  0  1   2   3    4    5    6    7     8

Notice that every power of two is a 1 followed by zeros — the same pattern as powers of ten in decimal.

Addition: One Rule

  0 + 0 = 0
  0 + 1 = 1
  1 + 0 = 1
  1 + 1 = 0, carry 1

That last line is the whole difference from decimal. You carry at two rather than at ten, so carries happen far more often.

  carries:  1111
             1011      (11)
          +   110      ( 6)
          ───────
            10001      (17)

Working right to left: 1+0 = 1. 1+1 = 0 carry 1. 0+1+1 = 0 carry 1. 1+0+1 = 0 carry 1. And the final carry makes the leading 1.

This is genuinely all a computer's adder does. A full adder circuit takes two bits and a carry, and produces a sum bit and a carry bit. Chain enough of them together and you have a processor's arithmetic unit.

Multiplication is even simpler. Every digit of the second number is 0 or 1, so each partial product is either nothing or a copy of the first number shifted left. There is no multiplication table to learn — binary long multiplication is just shifting and adding.

Negative Numbers: Two's Complement

Binary has no minus sign. Computers represent negatives using two's complement, which is worth understanding because it explains several things that otherwise look arbitrary.

To get −5 in eight bits: write +5, flip every bit, add one.

   5  =  00000101
  flip  11111010
  +1    11111011   = −5

Check it by adding 5 and −5:

    00000101
  + 11111011
  ──────────
   100000000   → the ninth bit falls off the end, leaving 00000000

Zero, exactly as it should be. That is the point of the scheme: addition works unchanged for negatives, so a processor needs only one adder circuit rather than separate logic for subtraction.

It also explains two familiar oddities. −1 is a row of ones, because it is the value one below zero wrapping around. And an 8-bit signed range is −128 to 127, not −128 to 128 — zero takes one of the positive slots.

A width is essential here. −5 is 11111011 in eight bits and 1111111111111011 in sixteen. This calculator always states which width it is showing.

Bitwise Operations

These compare two numbers one bit at a time, with no carrying between columns.

     1100        1100        1100
  &  1010     |  1010     ^  1010
  ───────     ───────     ───────
     1000        1110        0110
     AND          OR         XOR

AND gives 1 only where both are 1. Used to maskvalue & 00001111 keeps the low four bits and clears the rest.

OR gives 1 where either is 1. Used to set bits — value | 00000001 turns on the lowest bit and leaves the others alone.

XOR gives 1 only where the bits differ. Used to toggle, and it has a neat property: applying it twice returns the original. That is why XOR appears in simple encryption, in swapping two variables without a temporary, and in parity checks.

This calculator does not offer bitwise NOT, and the reason is honest rather than lazy: NOT has no meaning without a fixed width. NOT 1011 is 0100 in four bits and 11110100 in eight, and there is no way to know which you meant. The two's complement output covers the same ground while stating the width it assumes.

Shifting

Moving every bit one place left doubles the value; one place right halves it.

  1011 << 2  =  101100      11 × 4 = 44
  1011 >> 2  =      10      11 ÷ 4 = 2, remainder 3 discarded

Left shifts are exact. Right shifts are not reversible — the bits that fall off the end are gone, and shifting back left brings in zeros, not the lost bits. This calculator says so when a shift discards something.

Shifting is much faster than multiplying on real hardware, which is why compilers quietly replace × 8 with << 3.

Step-by-Step Example

Adding 1011 and 110.

  1011 = 8 + 2 + 1 = 11
   110 = 4 + 2     =  6

  carries:  1111
             1011
          +  0110
          ───────
            10001  = 16 + 1 = 17  ✓

Dividing 1011 by 110.

  11 ÷ 6 = 1 remainder 5
  In binary: 1 remainder 101
  Check: 1 × 110 + 101 = 110 + 101 = 1011  ✓

Integer division, as a processor does it — a quotient and a remainder, not a decimal.

Understanding Your Result

The result is in binary, grouped in fours like a memory dump.

The decimal and other bases lines give the same value in forms you can sanity check.

The column by column working shows the carries for addition, or the operand alignment for a bitwise operation.

The bit detail gives the bit count, how many are set, and — for a negative — the two's complement form at 8 and 32 bits.

When Should You Use This Calculator?

Learning how computers work. Binary arithmetic is the foundation, and the carry working makes it concrete.

Programming. Bit masks, flags, permissions and packed data all need bitwise operations.

Networking. Subnet masks are binary AND applied to IP addresses.

Embedded and hardware work. Registers are read and written bit by bit.

Debugging. A value that looks odd in decimal is often obviously wrong in binary.

Computer science coursework. Two's complement and bitwise operations are standard examination topics.

Common Mistakes

Forgetting to carry. 1 + 1 is 10, not 2. It is the one rule, and it is the one people skip.

Reading binary as decimal. 10 in binary is two, not ten.

Ignoring width with negatives. Two's complement means nothing without a stated number of bits.

Expecting a right shift to be reversible. Bits shifted off the end are lost.

Confusing bitwise AND with logical AND. & compares bits; && compares truth values. In most languages they are different operators with different results.

Assuming binary division gives a fraction. This is integer division: quotient and remainder.

Trusting parseInt on long binary strings. It loses precision past about sixteen digits. This calculator uses exact arithmetic, so a 64-bit value is correct to the last bit.

Miscounting bits. Eight bits make a byte, and a byte holds 0 to 255 — that is 256 values, not 255. The off-by-one here catches everybody at least once.

Frequently Asked Questions

How does binary addition work?

Exactly like decimal addition, but you carry at two instead of at ten. 0 plus 0 is 0, 0 plus 1 is 1, and 1 plus 1 is 0 with a carry. That single carry rule is all a computer's adder circuit needs to implement.

What is two's complement?

The way computers store negative numbers. Flip every bit of the positive value and add one, and the result can be added to the original to give zero within a fixed width. It is why minus one appears as a row of ones, and why addition works unchanged for negatives.

What do AND, OR and XOR actually do?

They compare two numbers one bit at a time. AND gives 1 only where both bits are 1, OR gives 1 where either is, and XOR gives 1 only where they differ. They are used for masking, setting flags, and toggling individual bits.

Why does shifting left multiply by two?

Because each place in binary is worth twice the one to its right, so moving every digit one place left doubles the value. It is the same reason adding a zero to the end of a decimal number multiplies by ten.

Why does binary division lose the fractional part?

This calculator does integer division, which is what processors do with whole numbers: it gives a quotient and a remainder rather than a decimal. 1011 divided by 110 is 1 remainder 101, the same as 11 divided by 6 being 1 remainder 5.

Last reviewed September 18, 2026 by the CalculatorPeak editorial team.