Bitwise Calculator

Apply bitwise AND, OR, XOR, NOT, and shift operations to two integers and see every result at once. This free online developer calculator runs entirely in your browser — no signup, no data sent anywhere.

· Reviewed by the CalculatorHive editorial team

Inputs

Results

A AND B
A OR B
A XOR B
NOT A
A << 1
A >> 1

How It Works (Formula & Method)

AND returns 1 only where both operands have a 1 bit; OR returns 1 where either does; XOR returns 1 where exactly one does. NOT inverts every bit of A. The shift operations move A’s bits one position left (multiply by 2) or right (integer divide by 2).

Worked Example

Below is a worked example using the calculator's default values. The same numbers are pre-filled in the form above so you can press Calculate and see the result without typing anything.

Inputs used:

  • Integer A: 12
  • Integer B: 10

With these inputs, the calculator computes the metrics shown in the Results panel. Change any value and press Calculate again to see how the result responds — the live widget and the chart both update instantly.

About the Bitwise Calculator

Bitwise operations work on the individual bits of an integer rather than its numeric value. They power feature flags, permission masks, hashing, graphics, and countless performance-critical algorithms. This calculator shows the result of every common bitwise operation on two integers simultaneously.

Tips & Considerations

  • AND with a mask isolates specific bits; OR with a mask sets them; XOR with a mask toggles them.
  • Left-shifting by n multiplies by 2ⁿ; right-shifting by n divides by 2ⁿ and discards the remainder.
  • XOR is its own inverse — applying the same XOR value twice returns the original number, the basis of simple ciphers and swap tricks.

Frequently Asked Questions

What is a bitmask?

A bitmask is an integer whose bits act as on/off switches. Combining it with AND, OR, or XOR lets you read, set, or toggle individual flags packed into a single number.

Why does NOT A look like a large negative number?

Integers are stored in two’s-complement form. Inverting every bit of a positive number produces a negative result equal to −(A + 1).

What is the difference between << and >>?

The << operator shifts bits toward the most significant end (doubling the value); >> shifts toward the least significant end (halving it, rounding down).

What does the Bitwise Calculator compute?

The Bitwise Calculator takes 2 input values and returns 6 results. Compute bitwise AND, OR, XOR, NOT, and bit shifts on two integers — the operations behind flags, masks, and low-level code.

Ad placement