EN
My tools

Bitwise Calculator (Programmer Calculator)

AND, OR, XOR, NOT, NAND, NOR, shifts, rotates and bit set/clear/test on 8-, 16-, 32- or 64-bit integers, with hex, binary, octal and signed results.

Decimal (negative = two's complement), 0x hex, 0b binary or 0o octal. Spaces and _ are ignored.
Result
0x0A
8-bit
Binary
0000 1010
Unsigned
10
Signed (two's complement)
10
Octal
0o12
Set bits (popcount)
2
even parity
Leading zeros
4
Trailing zeros
1
Operands and result
HexBinaryUnsignedSigned
A0xCA1100 1010202-54
B0x0F0000 11111515
Result0x0A0000 10101010
My tools →
Advertisement

Bit masks, flags, register values and hash functions are easier to reason about when you can see the bits. This programmer calculator applies AND, OR, XOR, NOT, NAND, NOR, XNOR, shifts, rotates and single-bit set/clear/toggle/test to 8-, 16-, 32- or 64-bit integers, and wraps addition, subtraction and multiplication the way fixed-width hardware does. Enter numbers in decimal, hex, binary or octal; every result is shown in all four, as signed and unsigned, with its population count and leading and trailing zeros.

How to use this tool

  1. Enter A, in decimal (negative numbers become two's complement), 0x hex, 0b binary or 0o octal.
  2. Choose the operation.
  3. Enter B — a second operand, a shift or rotate amount, or a bit number counted from 0 at the right.
  4. Pick the width; values must fit in it.
  5. Read the result in hex, binary, decimal (unsigned and signed) and octal.

Formula

AND 1∧1 = 1 · OR 0∨0 = 0 · XOR 1⊕1 = 0 · NOT flips every bit · A << n = A × 2ⁿ mod 2ʷ · A >>> n = ⌊A ÷ 2ⁿ⌋

All arithmetic is exact (BigInt) and masked to the chosen width w. The arithmetic shift >> copies the sign bit into the vacated positions (the signed value is divided by 2ⁿ, rounding down); the logical shift >>> fills them with zeros. Rotates move bits that fall off one end back in at the other. Signed values use two's complement: a pattern with the top bit set means value − 2ʷ.

Example

A = 0b1100_1010 (0xCA, 202) AND B = 0x0F keeps only the low four bits: 0x0A = 0000 1010 = 10. With A = −16 in 8 bits (0xF0), an arithmetic shift right by 2 gives 0xFC = −4, while a logical shift gives 0x3C = 60.

Frequently asked questions

What is the difference between >> and >>>?

For a negative number >> keeps it negative by filling with 1 bits (an arithmetic shift), while >>> fills with 0 bits and treats the pattern as unsigned. Java and JavaScript have both operators; C and C++ use >> for both, depending on whether the type is signed.

How do I check whether a flag is set?

Use "Test bit B of A", or AND the value with a mask that has only that bit set: (A & (1 << n)) != 0.

Why does 200 + 100 give 44 in 8 bits?

300 does not fit in a byte (maximum 255), so the result wraps around: 300 − 256 = 44, just as an unsigned 8-bit register would.

What does popcount mean?

The number of 1 bits. An odd count means odd parity, which simple error checks use.

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). Bitwise Calculator (Programmer Calculator). https://kakao.mobile/tools/bitwise-calculator/

MLA

“Bitwise Calculator (Programmer Calculator).” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/bitwise-calculator/.

Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms

Advertisement