FormatterHQ

NOT Calculator

Invert every bit of a number with a bitwise NOT. See the one's complement in the bit width you choose, with unsigned and signed two's complement values.

Loading tool…
Ready.

How to use the NOT Calculator

  1. Type a whole number in Operand A; NOT takes a single operand.
  2. Choose the input base and the bit width (8-bit by default).
  3. Read the inverted value in unsigned and signed decimal, hex, octal and binary.
  4. Copy the result you need.

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

WidthNOT 12Hex
8-bit2430xF3
16-bit655230xFFF3
32-bit42949672830xFFFFFFF3

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.

Frequently asked questions

What is NOT 12 in binary?
In 8 bits, 12 is 00001100 and NOT 12 is 11110011, which is 243 unsigned or −13 signed. With a wider bit width, more leading 1s are added.
Why does ~12 give −13 in JavaScript?
JavaScript applies ~ to a 32-bit signed integer. Flipping all 32 bits of 12 gives 0xFFFFFFF3, which reads as −13 in two's complement. The formula ~x = −x − 1 always holds for signed integers.
What is the difference between one's complement and two's complement?
One's complement is just NOT: every bit inverted. Two's complement adds 1 to that, and it is how virtually all modern computers represent negative integers.
Can I invert a hexadecimal value?
Yes. Choose hex as the input base or type the value with a 0x prefix. NOT 0x0F in 8 bits gives 0xF0.

Last updated October 3, 2026

Related tools