Number & Data

Bitwise Calculator

Perform AND, OR, XOR, NOT, SHL, and SHR operations on hex values. Results in hex, decimal, and binary.

Shift amount:
Hex
Decimal
Binary
0 bits

How to use this tool

  1. Enter hex values into Operand A (Hex) and Operand B (Hex). Values can be plain (AB12) or prefixed (0xAB12).
  2. Pick an operation — AND, OR, XOR, NOT, SHL, or SHR — to run it immediately.
  3. For SHL/SHR, set the Shift amount (0–256). NOT and shifts only use Operand A, so Operand B is ignored.
  4. Read the result in Hex, Decimal, and Binary. Everything recalculates live as you type.
  5. Hit Copy Hex to copy the result to your clipboard.

Why this tool is helpful

Set & clear flags

Use OR to turn bits on and AND with a mask to turn them off — the everyday pattern behind permission and status flags.

Compare binary values

XOR reveals which bits differ between two values, handy for checksums, change detection, and toggling individual bits.

Build & read bitmasks

See the exact hex, decimal, and binary of any mask in one place, so you always know which bits are set.

Multiply & divide by powers of two

SHL by n multiplies by 2n, SHR divides — the same fast shifts used in low-level code.

Work beyond 32/64 bits

Backed by JavaScript BigInt, results never overflow at word size, unlike native number operations.

Stay private

Everything runs in your browser. Nothing is uploaded, logged, or sent to a server — safe for sensitive values.

FAQ

What does this calculator do?

It applies bitwise operators — AND, OR, XOR, NOT, SHL, and SHR — to hex values and shows the result as hex, decimal, and binary.

What do the operators mean?

AND keeps bits set in both operands, OR keeps bits set in either, XOR keeps bits that differ, NOT flips every bit, and SHL/SHR shift bits left or right by the shift amount.

Why does NOT give a negative result?

Numbers use two's complement, so NOT of a positive value flips its sign bit too, producing a negative result. For example, NOT 0x0F is -0x10.

Why is Operand B ignored for NOT and shifts?

NOT only inverts one value, and SHL/SHR need just one operand plus a shift amount, so the second operand isn't used for those operations.

Can it handle values larger than 32 or 64 bits?

Yes. It uses JavaScript BigInt for arbitrary-precision math, so results won't silently wrap or overflow at a word size.

What counts as valid input?

Hex digits 0–9 and a–f (case-insensitive), with an optional 0x prefix. Empty or non-hex input clears the result rather than showing a wrong value.

Does any of my data leave my browser?

No. All calculation happens locally in JavaScript. Your values are never sent to, stored on, or logged by any server.