Bitwise NOT calculator
This NOT calculator flips every bit of a number: 0s become 1s and 1s become 0s. The result, called the one's complement, only makes sense for a fixed number of bits, so you choose 8, 16, 32 or 64 bits and the tool shows the inverted pattern at that width.
Worked 8-bit example: NOT 12
NOT 00001100 (12)
= 11110011 (243, signed −13, 0xF3)
Every bit of 12 is flipped. Read as an unsigned byte the result is 243; read as a signed byte it is −13. The tool shows both, plus hex and octal.
Two formulas worth remembering
- Unsigned: NOT x = (2^n − 1) − x. For 8 bits, 255 − 12 = 243.
- Signed: NOT x = −x − 1. So NOT 12 is −13, whatever the width.
The second rule explains why ~12 prints −13 in JavaScript, C and Python: those languages show the signed reading.
NOT and two's complement
Computers store negative integers in two's complement, which is simply NOT plus one. To negate 12 in 8 bits, invert it to 243 and add 1, giving 244 (11110100), the bit pattern for −12. You can check this by entering -12 here: negative inputs are stored in two's complement, so the tool first reads -12 as 11110100 and then inverts it to 00001011, which is 11.
Same input, different widths
| Width | NOT 12 | Hex |
|---|---|---|
| 8-bit | 243 | 0xF3 |
| 16-bit | 65523 | 0xFFF3 |
| 32-bit | 4294967283 | 0xFFFFFFF3 |
Edge cases behave as you would expect: NOT 255 in 8 bits is 0, and NOT 0 in 16 bits is 65535.
Common uses
- Clearing bits: x AND NOT mask turns off the masked bits. To clear bit 2 of a byte, AND with NOT 4, which is 251.
- Wildcard masks: the NOT of a subnet mask gives the wildcard mask used in router access lists, so 255.255.255.0 becomes 0.0.0.255.
- Checking complements: verifying that a stored value and its inverted copy match, a pattern used in some memory and firmware integrity checks.
One operand, live result
NOT takes a single operand, so unlike the other bitwise operations it does not combine inputs and only the Operand A field is shown. The result updates as you type; to invert another value, replace the number, or click a bit in the grid to flip that bit of the input.
For inversions combined with another operation, see the NAND calculator and NOR calculator. To see a number's plain bit pattern without inverting it, use decimal to binary.