Bitwise Calculator

AND, OR, XOR, NOT and shifts, with the bits shown.

Tech Calculators Free, no sign-up Runs in your browser

Bitwise Calculator tool

—
Result
—
Result in bits
—
In hexadecimal
—
Bits set
—
As a signed value
OperationDecimalBits
Width matters. ~202 is 53 in eight bits and 4294967093 in thirty-two, because NOT flips every bit in the register and the register size is part of the answer. Pick the width your language or protocol actually uses.

About the Bitwise Calculator

Bitwise Calculator applies AND, OR, XOR, NOT and the two shift operations to numbers at a fixed register width, and shows the bit pattern at every step. Seeing the bits lined up is the point: bitwise operations are column arithmetic, and once the columns are visible the result stops being mysterious.

Width is a genuine input, not a display choice. AND, OR and XOR give the same answer at any width, but NOT and the shifts do not: ~202 is 53 in eight bits and 4,294,967,093 in thirty-two, because NOT flips every bit in the register and a wider register has more bits to flip. A left shift past the top of the register loses those bits entirely. Choose the width your language or protocol actually uses and the answer will match it.

These operations are the basis of flags and masks. AND with a mask tests or clears bits, OR sets them, XOR toggles them, and a shift moves a value into position within a packed field. Permission bits, network masks, hardware registers and compression formats are all built from exactly these five operations, which is why the comparison rows show AND, OR and XOR together.

The page shows its working, not just its answer. Where there is a formula it is printed with your own numbers substituted in, so you can check the result rather than take it on trust -- which is the difference between a calculator you can use for something that matters and one you cannot.

Everything runs inside your browser. What you type is never uploaded, never logged and never stored, and the calculator keeps working if your connection drops after the page has loaded.

Looking for something this does not cover? FreeToolsHub.org is another hub of free online tools that need no account, and it is worth a look if bitwise calculator is only part of what you are working on.

How to use the Bitwise Calculator

  1. Choose operation and widthThe fields below change to match what you pick, so only the figures that matter to your case are asked for.
  2. Enter first number and second number or shift countDecimals are fine, and thousands separators are accepted and ignored.
  3. Read the result, result in bits and in hexadecimalThe figures update as you type. The Calculate button is there if you would rather press something, but nothing waits for it.
  4. Copy or check the resultCopy the summary with the copy button, or open the table to check it row by row and read the formula with your own numbers in it.

Features

  • Shows result, result in bits, in hexadecimal, bits set and as a signed value together, so you are not running it twice
  • A results table you can read across
  • Prints the formula with your own figures substituted in
  • Updates as you type, with no button to press and no page reload
  • Copy the result in one click
  • Free, no sign-up, and it runs entirely in your browser

Who uses this tool

The bitwise calculator is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:

  • Testing or setting flag bits with a mask
  • Checking what a shift does to a value
  • Working out a permissions or register value
  • Debugging a packed binary field

Frequently asked questions

Why does NOT depend on the width?

Because it flips every bit in the register. Eight bits and thirty-two bits give very different numbers for the same input.

What is the difference between AND and OR?

AND sets a result bit only when both inputs have it set, so it clears bits. OR sets it when either does, so it sets bits.

What does XOR get used for?

Toggling bits, simple checksums and detecting difference: a XOR b is zero only when the two are identical.

Where do bits go when I shift them out?

They are discarded. A left shift past the top of the register loses the high bits, which is why the width matters.

If the bitwise calculator is not quite what you need, these other free tools solve closely related problems, and there are 11 more in tech calculators.

Binary Calculator

Binary arithmetic with decimal, hex and octal output.

Tech Calculators Use tool

Hex Calculator

Hex arithmetic with decimal, binary and octal output.

Tech Calculators Use tool

Subnet Calculator

IPv4 subnet details from an address and prefix.

Tech Calculators Use tool

Number Base Converter

Convert a number between binary, octal, decimal, hex and custom bases.

Encoding & Conversion Use tool

Byte Converter

Bytes to KB, MB, GB and the KiB/MiB/GiB family.

Tech Calculators Use tool

Checked and rebuilt on 2026-10-14. The method this calculator uses is described in the section above, and corrections go through the contact page.