Binary Bitwise NOT Calculator
Calculate the bitwise NOT (one's complement) of binary, decimal, or hex numbers for 8, 16, 32, and 64-bit widths with signed and unsigned results.
About
The bitwise NOT operation flips every bit of an integer within a fixed bit width N. A 0 becomes 1 and a 1 becomes 0. The result depends entirely on the chosen bit width. Applying NOT to the 8-bit value 0000 0101 (5) yields 1111 1010, which is 250 unsigned or −6 in two's complement signed representation. Getting the signedness wrong when working with registers, masks, or network protocols causes silent data corruption that compilers will not catch.
This calculator performs real one's complement inversion for 8, 16, 32, and 64-bit widths. It accepts input in binary, decimal, or hexadecimal and returns both signed and unsigned interpretations. The tool uses BigInt arithmetic internally so 64-bit results are exact. Note: the output assumes a fixed-width register model. Variable-width or arbitrary-precision NOT is undefined without a stated bit width.
Formulas
The bitwise NOT operation inverts each bit within a fixed-width register of N bits. Given an unsigned integer x where 0 ≤ x ≤ 2N − 1, the unsigned NOT result is:
This is equivalent to XOR-ing x with a mask of all ones:
To interpret the result as a signed two's complement integer s:
where u = NOT(x) is the unsigned result, N is the bit width (8, 16, 32, or 64), and x is the original unsigned input value. The relationship NOT(x) = −x − 1 holds in two's complement signed arithmetic for all values within the representable range.
Reference Data
| Decimal Input | Bit Width | Binary Input | NOT Binary | NOT Unsigned | NOT Signed |
|---|---|---|---|---|---|
| 0 | 8 | 00000000 | 11111111 | 255 | −1 |
| 1 | 8 | 00000001 | 11111110 | 254 | −2 |
| 5 | 8 | 00000101 | 11111010 | 250 | −6 |
| 127 | 8 | 01111111 | 10000000 | 128 | −128 |
| 128 | 8 | 10000000 | 01111111 | 127 | 127 |
| 255 | 8 | 11111111 | 00000000 | 0 | 0 |
| 0 | 16 | 0000000000000000 | 1111111111111111 | 65535 | −1 |
| 256 | 16 | 0000000100000000 | 1111111011111111 | 65279 | −257 |
| 32767 | 16 | 0111111111111111 | 1000000000000000 | 32768 | −32768 |
| 65535 | 16 | 1111111111111111 | 0000000000000000 | 0 | 0 |
| 0 | 32 | 00000000...0 (32 bits) | 11111111...1 (32 bits) | 4294967295 | −1 |
| 1 | 32 | 00000000...1 | 11111111...0 | 4294967294 | −2 |
| 2147483647 | 32 | 01111111...1 | 10000000...0 | 2147483648 | −2147483648 |
| 0 | 64 | 0...0 (64 bits) | 1...1 (64 bits) | 18446744073709551615 | −1 |
| 42 | 8 | 00101010 | 11010101 | 213 | −43 |
| 170 | 8 | 10101010 | 01010101 | 85 | 85 |
| 240 | 8 | 11110000 | 00001111 | 15 | 15 |
| 15 | 8 | 00001111 | 11110000 | 240 | −16 |