Developer Tools

Bitwise calculator.

AND, OR, XOR, NOT and bit shifts on 8, 16, 32 or 64-bit values. Enter decimal, hex, binary or octal, see the signed and unsigned result and the bits lined up. Runs in your browser.

Advertisement

Input

Result

Enter values, then press Calculate.

Advertisement

How it works

Sources: MDN, JavaScript operators (see <<, >>, >>>); Wikipedia, Bitwise operation. Related: Two's Complement Calculator, IEEE 754 Float Converter, Binary Converter.

Worked example at 8 bits

A = 240 (1111 0000, hex F0) and B = 60 (0011 1100, hex 3C). Results come from running this page’s calculator code on 2026-10-26.

Bitwise operation examples at 8 bits
OperationInput bitsResult bitsUnsigned / signed
A & B1111 0000 and 0011 11000011 000048 / 48
A | B1111 0000 and 0011 11001111 1100252 / -4
A ^ B1111 0000 and 0011 11001100 1100204 / -52
~50000 01011111 1010250 / -6
13 << 20000 11010011 010052 / 52
−16 >> 21111 00001111 1100252 / -4
−16 >>> 21111 00000011 110060 / 60

Sources and as-of date

As of 2026-10-26. Operator semantics follow the MDN reference for JavaScript, applied here at the width you pick.

Advertisement

Frequently asked questions

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

>> copies the sign bit into the gap, so negative numbers stay negative: at 8 bits, −16 (1111 0000) shifted right by 2 is -4 (1111 1100). >>> fills with zeros, so the same input gives 60 (0011 1100).

Why is ~5 equal to −6?

NOT flips every bit inside the chosen width. At 8 bits 5 is 0000 0101, so ~5 is 1111 1010, which is 250 unsigned and -6 as a two’s complement signed value.

Why does JavaScript give different answers for large values?

JavaScript applies bitwise operators to 32-bit integers and takes shift counts modulo 32. This tool uses BigInt at 8, 16, 32 or 64 bits, so a 64-bit mask stays exact and an out-of-range shift count is rejected instead of wrapped.

How do I test whether one bit is set?

AND the value with a mask that has only that bit. 60 & 4 gives 4, which is not zero, so bit 2 of 0011 1100 is set.