Bitwise Calculator — AND, OR, XOR, NOT, NAND, NOR, XNOR
Apply any bitwise logic operation — AND, OR, XOR, NAND, NOR, XNOR or NOT — to two integers within a selectable bit width, and see the result in decimal, binary and hex with a step-by-step bit column view.
Művelet
Bit width
A
B
&
Result
Hogyan működik ez a kalkulátor?
Bitwise operations act on each bit pair independently. AND: 1 & 1 = 1, else 0; OR: 0 | 0 = 0, else 1; XOR: equal bits → 0, different → 1. NOT flips all bits within the register width. NAND/NOR/XNOR invert AND/OR/XOR. All results are masked to the chosen bit width (4/8/16/32/64).
Képlet
How this is calculated
Bitwise operators work independently on each corresponding pair of bits in two operands, making them extremely fast on modern CPUs (single-cycle instructions). The six standard operations are: AND (result bit 1 only when both input bits are 1 — used to extract or test bit fields), OR (result bit 1 when either input bit is 1 — used to set bits), XOR (exclusive OR: result bit 1 when bits differ — used to toggle bits or compute parity), and their negated counterparts NAND, NOR and XNOR. NOT is unary — it flips all bits within the specified register width.
All calculations are performed with JavaScript BigInt for exact integer arithmetic at any bit width up to 64. The operands are masked to the chosen width before the operation, so a value of 60 in an 8-bit context is treated as 0011 1100. The result is also masked, ensuring it fits within the register. This mirrors the behaviour of fixed-width unsigned integer types in C, Rust and most systems languages.
The bit-by-bit working panel aligns the binary representations of A, B, and the result column by column so you can verify each output bit against the truth table mentally. This is the most direct way to understand what the operation is doing at the hardware level.
Gyakran ismételt kérdések
XOR is used for bit toggling, in-place variable swapping (a ^= b; b ^= a; a ^= b), parity computation, simple encryption/masking, and in hash functions. A key property is that A ^ A = 0 and A ^ 0 = A, making XOR a self-inverting operation.
NOT flips every bit within the chosen register width. In an 8-bit register, NOT 0 = 1111 1111 = 255. In a 16-bit register, NOT 0 = 65 535. The result depends on the bit width you select, which is why you should always match the width to your target data type.
To test or extract specific bits, AND the value with a bitmask that has 1s in the positions you care about and 0s elsewhere. For example, to isolate the lower 4 bits of a byte, AND with 0x0F (0000 1111). The result clears all upper bits while preserving the lower nibble.
Más néven
TG we-Calculate Editorial Team. (2026). Bitwise Calculator — AND, OR, XOR, NOT, NAND, NOR, XNOR [Online calculator]. TG we-Calculate. https://we-calculate.com/hu/calculator/bitwise-calculator
TG we-Calculate Editorial Team. "Bitwise Calculator — AND, OR, XOR, NOT, NAND, NOR, XNOR." TG we-Calculate. 2026. https://we-calculate.com/hu/calculator/bitwise-calculator.
TG we-Calculate Editorial Team, "Bitwise Calculator — AND, OR, XOR, NOT, NAND, NOR, XNOR," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/hu/calculator/bitwise-calculator
@misc{wecalculate_bitwise_calculator, title = {Bitwise Calculator — AND, OR, XOR, NOT, NAND, NOR, XNOR}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/hu/calculator/bitwise-calculator}}, year = {2026}, note = {TG we-Calculate} }
Segített ez a kalkulátor?
