Bytelify

Bitwise Calculator

Compute AND, OR, XOR, NOT, and bit shifts on integers, live as you type.

Runs in your browser, nothing sent
bitwise-calculator
8 (binary: 1000)

Operates on 32-bit signed integers, matching JavaScript's own bitwise operators. Updates live. Runs entirely in your browser.

Need the opposite? XOR Calculator

What is Bitwise Calculator?

Enter one or two integers, pick an operation (AND, OR, XOR, NOT, left/right shift), and see the result instantly in both decimal and binary. It uses JavaScript's own 32-bit bitwise operators, the same ones your code would use. Useful for sanity-checking a bitmask, flag combination, or shift operation before it goes into code, or for working out by hand what a line like `flags & 0x08` or `value >> 2` actually evaluates to. Everything computes live in your browser as you type, with no size limit beyond the 32-bit range the operations themselves are defined over.

AND / OR / XOR Truth Table

A, BAND | OR | XOR
0, 00 | 0 | 0
0, 10 | 1 | 1
1, 00 | 1 | 1
1, 11 | 1 | 0

How to Use the Bitwise Calculator

  1. 1

    Enter One or Two Integers: Type the values you want to operate on.

  2. 2

    Choose an Operation: Pick AND, OR, XOR, NOT, or a shift.

  3. 3

    Read the Result Instantly: The decimal and binary result appears automatically.

How AND, OR, and XOR Work Bit by Bit

Each operator compares two numbers one bit position at a time. AND (&) produces a 1 only when both bits are 1. OR (|) produces a 1 when at least one bit is 1. XOR (^) produces a 1 only when the two bits differ. Worked example with 12 (binary 1100) and 10 (binary 1010): 12 & 10 = 8 (1000): only the third bit is 1 in both. 12 | 10 = 14 (1110): every bit that's 1 in either number. 12 ^ 10 = 6 (0110): the bits where 12 and 10 differ. NOT (~) flips every bit, including the sign bit, which is why ~12 gives -13 rather than a positive number. This is two's-complement behavior, the same as `~x` in JavaScript or C.

Shift Operators

  • Left shift (<<): Moves every bit left by the given amount, filling with 0s on the right. It's equivalent to multiplying by 2 for each position shifted: 4 << 2 = 16 (4 × 2²).

  • Right shift (>>): Moves bits right, filling from the left with copies of the sign bit, so negative numbers stay negative: -8 >> 1 = -4.

  • Unsigned right shift (>>>): Always fills with 0s regardless of sign, which is why it turns a negative number into a large positive one: -8 >>> 1 = 2147483644.

FAQs

Frequently Asked Questions

Common questions about Bitwise Calculator.

32-bit signed integers, matching JavaScript's native bitwise operator behavior exactly.

Bitwise NOT flips every bit, and since the result is a 32-bit signed integer, flipping the sign bit produces a negative value. This matches what `~x` does in JavaScript, C, and most other languages.

A regular right shift preserves the sign bit (fills with 1s for negative numbers), while an unsigned right shift always fills with 0s, matching JavaScript's `>>` versus `>>>` operators.

Yes, Bytelify's Bitwise Calculator is free with no account or sign-up required.

No. The computation runs entirely client-side in your browser, so nothing you enter is sent anywhere.