User Rating 0.0
Total Usage 0 times
Presets:
Is this tool helpful?

Your feedback helps us improve.

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.

bitwise NOT binary calculator ones complement bit manipulation bitwise operations binary NOT two's complement

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:

NOT(x) = (2N 1) x

This is equivalent to XOR-ing x with a mask of all ones:

NOT(x) = x (2N 1)

To interpret the result as a signed two's complement integer s:

s = {
u if u < 2N1u 2N otherwise

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 InputBit WidthBinary InputNOT BinaryNOT UnsignedNOT Signed
080000000011111111255−1
180000000111111110254−2
580000010111111010250−6
12780111111110000000128−128
12881000000001111111127127
2558111111110000000000
0160000000000000000111111111111111165535−1
256160000000100000000111111101111111165279−257
32767160111111111111111100000000000000032768−32768
65535161111111111111111000000000000000000
03200000000...0 (32 bits)11111111...1 (32 bits)4294967295−1
13200000000...111111111...04294967294−2
21474836473201111111...110000000...02147483648−2147483648
0640...0 (64 bits)1...1 (64 bits)18446744073709551615−1
4280010101011010101213−43
170810101010010101018585
240811110000000011111515
1580000111111110000240−16

Frequently Asked Questions

Bitwise NOT flips every bit in the register, not just the significant bits of the value. In 8-bit, 5 is 00000101, and NOT gives 11111010 (250 unsigned). In 16-bit, 5 is 0000000000000101, and NOT gives 1111111111111010 (65530 unsigned). The additional leading zero bits all flip to ones, producing a larger result. Always match the bit width to your target architecture.
In two's complement arithmetic, NOT(x) = x 1. This means the signed interpretation of NOT(5) is −6, not −5. To negate a value, you compute NOT(x) + 1. Confusing NOT with negation is a common source of off-by-one errors in low-level code.
No. The calculator validates that your input fits within the selected bit width. For 8-bit, the maximum unsigned value is 255 (28 1). For 16-bit it is 65535, for 32-bit it is 4294967295, and for 64-bit it is 18446744073709551615. If the value overflows, the tool will show an error. Reduce the value or increase the bit width.
JavaScript's standard Number type loses integer precision above 253 1. This calculator uses BigInt arithmetic for all internal computation, which supports arbitrary-precision integers. This ensures exact results for the full 64-bit unsigned range up to 18446744073709551615.
The signed two's complement interpretation depends on the most significant bit (MSB). If the MSB of the NOT result is 0, the signed value equals the unsigned value. For example, NOT of 10101010 (170) in 8-bit is 01010101 (85). Since the MSB is 0, signed and unsigned are both 85. The signed result is negative only when the MSB of the NOT output is 1.
Bitwise NOT is used to create bitmask complements for permission flags (e.g., clearing specific bits with x & NOT(mask)). It appears in checksum algorithms, one's complement network checksums (IP, TCP, UDP per RFC 1071), graphics programming for color inversion, and cryptographic primitives. In subnet calculations, NOT of a subnet mask yields the wildcard mask.