How bitwise AND works
AND compares two numbers bit by bit and keeps a 1 only where both bits are 1. In hex, F0 AND 3C = 30, because 1111 0000 AND 0011 1100 = 0011 0000. AND is how you apply a mask: value AND 0xFF keeps the lowest byte, and an IP address AND its subnet mask gives the network address.
OR, XOR, NAND and NOR
OR sets a bit if either input has it (used to switch flags on). XOR sets it when the bits differ (used to toggle flags and in checksums and simple ciphers). NAND and NOR are the inverted forms, calculated here at the width of the longer input. Values of any length are supported through BigInt.
Frequently asked questions
What is 0xFF AND 0x0F?
0x0F.
How do I check if a flag is set?
AND the value with the flag. A non-zero result means it is set.
✨ New: Remove the background from any image free – private, in your browser, transparent PNG.
Related free tools
Note: This free tool runs entirely in your browser. No data is sent or stored. Results are for information only.