This tool runs entirely in your browser. Nothing you paste is uploaded.
How you can check →Bitwise Calculator
Numbers & BitsAND, OR, XOR, NOT and shifts at any width — including 64-bit and beyond, where JavaScript's own operators silently break.
Operator
Width
Bits
Need to convert between bases instead? See the number base converter.
No network activity while you use this tool Show the numbers
- Requests to any other server
- 0
- Requests since you started typing
- —
- Same-origin requests
- 0
Counted live by your browser's own Performance Timeline — the same data the DevTools Network panel reads. It cannot see what a browser extension does, and it is not meant to replace checking for yourself: here is how, in thirty seconds .
What each operator does
AND sets a result bit only where both inputs have a 1 — useful for masking off bits you want to keep. OR sets a bit where either input has a 1 — useful for combining flags. XOR sets a bit where the inputs differ — used to toggle bits or compute a difference. NOT flips every bit. NAND, NOR and XNOR are simply AND, OR and XOR with the result inverted — NAND and NOR are "universal" gates that any digital circuit can be built from using only one of them.
Arithmetic vs logical shift, and what sign extension does
A left shift (<<) always fills the vacated low bits with 0. A right shift
has two different meanings depending on whether you care about the sign: an arithmetic shift
(>>) fills the vacated high bits with copies of the sign bit, so a negative
number shifted right stays negative — this is sign extension, and it is what almost every
language's >> operator does by default. A logical shift
(>>>) always fills with 0 regardless of sign, treating the value as a
plain bit pattern rather than a signed number. This tool's shift receipt shows exactly which
bits were dropped and whether sign extension happened, which is the detail behind most shift
bugs.
Why 1 << 32 gives four different answers in four languages
JavaScript's native shift and bitwise operators coerce both operands to a signed 32-bit
integer first, so a shift count is taken modulo 32 — 1 << 32 is
1, not 4294967296. C and Java's behaviour for a shift count at or past the type's
width is undefined or implementation-defined for a 32-bit int, and can differ by compiler.
Python has arbitrary-precision integers and no fixed width at all, so
1 << 32 is genuinely 4294967296 there. This tool takes an explicit width —
including "no width" for arbitrary precision — so the answer is always the one you actually
asked for.
How bit flags and masks work in practice
A bitmask is a value used with AND to test or clear specific bits, or with OR to set them —
permission flags, feature toggles and CPU status registers are all commonly packed this way,
one bit per flag. Testing whether a flag is set is value AND mask compared
against the mask itself; setting it is value OR mask; clearing it is
value AND (NOT mask).
Why 64-bit masks break most web calculators
Every calculator built on JavaScript's native bitwise operators truncates to 32 bits before doing anything, so a 64-bit mask — the normal case for a hash, a UUID, or a file permission bitmap — silently loses its top half. This tool runs entirely on BigInt, so 64-bit (and arbitrary-precision) masks compute exactly.
Common use cases
- Checking or combining permission/feature flags packed into one integer
- Understanding a shift bug — what actually fell off the end, and whether it sign-extended
- Computing a 64-bit bitmask without the silent 32-bit truncation JS calculators have
- Learning the difference between a shift and a rotate
- Seeing AND/OR/XOR visually, bit by bit, rather than as an opaque result
Frequently asked questions
- Why is 1 << 32 equal to 1 in JavaScript?
- JavaScript's native << coerces both operands to a signed 32-bit integer before shifting, so a shift amount of 32 wraps back to a shift of 0 — 1 << 32 is 1, not 4294967296. This tool takes an explicit width (up to 64-bit or arbitrary precision) and never coerces to 32 bits, so 1 << 32 at 64-bit width correctly gives 4294967296.
- What's the difference between an arithmetic and a logical right shift?
- An arithmetic shift (>>) fills the vacated high bits with copies of the sign bit, so a negative number stays negative — this is what C, Java and most languages do by default. A logical shift (>>>) always fills with 0 regardless of sign, treating the bits as a plain unsigned pattern. This tool's shift receipt shows exactly which bits were dropped and whether sign extension happened.
- Does this bitwise calculator work above 32 bits?
- Yes — that's the reason it exists. Every operator here runs on BigInt at the width you choose, including 64-bit and arbitrary precision, unlike calculators built on JavaScript's native operators, which silently truncate to 32 bits.
- What is a rotate, and how is it different from a shift?
- A shift discards the bits that fall off one end and fills the other end with zeros or a sign bit. A rotate instead wraps the bits that fall off back around to the other end, so no information is lost — ROTL and ROTR are what a hash function or a cipher's mixing step actually uses, not a plain shift.
- Does this tool upload my input anywhere?
- No. Every operation runs in this tab's JavaScript; nothing you type is sent anywhere. The privacy receipt below the tool measures the actual network requests from this page load.
Explore more tools
Convert between any base 2-36 with arbitrary size, an exact fractional half, and the width and sign always stated.
Decimal, hex or binary in — sign, exponent and mantissa out, with the exact stored value and the rounding error against what you typed.
Build a cron expression for any scheduler, or paste one to see what it runs.