Binary Calculator

Enter two binary numbers and choose an operation.

Operation

AND, OR and XOR compare the numbers digit by digit.

Only the digits 0 and 1; a leading minus sign is allowed.

Only the digits 0 and 1; a leading minus sign is allowed.

Try

Result

You entered10112 OR 1102\mathrm{1011}_{2}\ \mathrm{OR}\ \mathrm{110}_{2}

10112 OR 1102=11112\displaystyle \mathrm{1011}_{2}\ \mathrm{OR}\ \mathrm{110}_{2} = \mathrm{1111}_{2}

Decimal

11OR6=15\displaystyle 11 \mathrm{OR} 6 = 15

Hex

F16\displaystyle \mathrm{F}_{16}
Show the work
  1. Binary to decimal

    Each binary digit is worth a power of 22, counting from 00 at the right. Converting both numbers to decimal lets the operation be done with ordinary arithmetic.

    Using N=dk 2k+⋯+d1 2+d0N = d_{k}\,2^{k} + \cdots + d_{1}\,2 + d_{0}

    10112=1×23+0×22+1×21+1×20=8+0+2+1=111102=1×22+1×21+0×20=4+2+0=6\begin{gathered} \mathrm{1011}_{2} = 1 \times 2^{3} + 0 \times 2^{2} + 1 \times 2^{1} + 1 \times 2^{0} = 8 + 0 + 2 + 1 = 11 \\ \mathrm{110}_{2} = 1 \times 2^{2} + 1 \times 2^{1} + 0 \times 2^{0} = 4 + 2 + 0 = 6 \end{gathered}
  2. Bitwise OR

    Line the numbers up and compare them one column at a time. A result bit is 1 when at least one of the bits is 1.

    101101101111\begin{array}{rcccc} & 1 & 0 & 1 & 1 \\ & 0 & 1 & 1 & 0 \\ \hline & 1 & 1 & 1 & 1 \end{array}
  3. Decimal to binary

    Divide by 22 again and again, keeping each remainder, until the quotient is 00. The remainders read from the last to the first are the binary digits.

    Using N=2×q+r,r=0 or 1N = 2 \times q + r, \quad r = 0 \text{ or } 1

    15=2×7+17=2×3+13=2×1+11=2×0+1\begin{array}{l} 15 = 2 \times 7 + 1 \\ 7 = 2 \times 3 + 1 \\ 3 = 2 \times 1 + 1 \\ 1 = 2 \times 0 + 1 \end{array}
  4. Result

    So 10112 OR 1102=11112\mathrm{1011}_{2}\ \mathrm{OR}\ \mathrm{110}_{2} = \mathrm{1111}_{2}.

Worked examples

10112 + 1102\mathrm{1011}_{2}\ +\ \mathrm{110}_{2}
10112 + 1102=100012\mathrm{1011}_{2}\ +\ \mathrm{110}_{2} = \mathrm{10001}_{2}

Binary addition with carries, Check in decimal

10112 − 1102\mathrm{1011}_{2}\ -\ \mathrm{110}_{2}
10112 − 1102=1012\mathrm{1011}_{2}\ -\ \mathrm{110}_{2} = \mathrm{101}_{2}

Binary to decimal, Subtraction in decimal

1102 − 10112\mathrm{110}_{2}\ -\ \mathrm{1011}_{2}
1102 − 10112=−1012\mathrm{110}_{2}\ -\ \mathrm{1011}_{2} = -\mathrm{101}_{2}

Binary to decimal, Subtraction in decimal

10112 × 1102\mathrm{1011}_{2}\ \times\ \mathrm{110}_{2}
10112 × 1102=10000102\mathrm{1011}_{2}\ \times\ \mathrm{110}_{2} = \mathrm{1000010}_{2}

Binary to decimal, Multiplication in decimal

10112 ÷ 1102\mathrm{1011}_{2}\ \div\ \mathrm{110}_{2}
10112 ÷ 1102=12 remainder 1012\mathrm{1011}_{2}\ \div\ \mathrm{110}_{2} = \mathrm{1}_{2}\ \text{remainder}\ \mathrm{101}_{2}

Binary to decimal, Division with a remainder

10112 AND 1102\mathrm{1011}_{2}\ \mathrm{AND}\ \mathrm{110}_{2}
10112 AND 1102=102\mathrm{1011}_{2}\ \mathrm{AND}\ \mathrm{110}_{2} = \mathrm{10}_{2}

Binary to decimal, Bitwise AND

10112 OR 1102\mathrm{1011}_{2}\ \mathrm{OR}\ \mathrm{110}_{2}
10112 OR 1102=11112\mathrm{1011}_{2}\ \mathrm{OR}\ \mathrm{110}_{2} = \mathrm{1111}_{2}

Binary to decimal, Bitwise OR

10112 XOR 1102\mathrm{1011}_{2}\ \mathrm{XOR}\ \mathrm{110}_{2}
10112 XOR 1102=11012\mathrm{1011}_{2}\ \mathrm{XOR}\ \mathrm{110}_{2} = \mathrm{1101}_{2}

Binary to decimal, Bitwise XOR