Overview
Introduction
Bitwise NOT is the simplest logic gate: it takes a single value and flips every bit, with no second operand involved.
This tool computes the bitwise NOT of one binary value, preserving its original digit width so the output is always the same length as the input.
What Is Binary NOT Calculator?
A calculator for the bitwise NOT (complement) of a single binary value: every bit position is flipped, 1s become 0s and 0s become 1s.
Unlike the two-operand gate calculators in this category (AND, OR, XOR, and their inverses), NOT only ever takes one input value.
How Binary NOT Calculator Works
The input is validated as a binary string, and its own digit count becomes the width the operation runs at.
The value is parsed as a BigInt, complemented with `~value`, then masked to the input's width (so leading zero bits above that width aren't affected) and formatted back as a binary string of the same length.
When To Use Binary NOT Calculator
Use it to compute the bitwise complement of a mask or register value, for example to build the 'clear these bits' mask from a 'set these bits' mask.
It's also the natural building block to combine with AND when constructing a value that clears specific bits (AND with the NOT of a mask).
Often used alongside Binary AND Calculator, Binary OR Calculator and Binary XOR Calculator.
Features
Advantages
- Preserves the input's own width, so the output is never longer or shorter than what you typed in.
- Works on arbitrarily long binary values via BigInt, not limited to a fixed 8/16/32/64-bit width.
- Instant, deterministic, fully client-side.
Limitations
- The result depends entirely on the digit width you typed; if you meant a wider register (e.g. an 8-bit value written as "101"), pad the input with leading zeros first.
- This is a pure bit-flip, not arithmetic negation; it doesn't add 1 to produce a two's-complement negative value.
Examples
Best Practices & Notes
Best Practices
- Pad the input with leading zeros first if you want NOT to operate at a specific fixed width (e.g. 8 or 16 bits) rather than the width you happened to type.
- Combine NOT with AND when you need to clear specific bits: AND the value with the NOT of your 'bits to clear' mask.
Developer Notes
Implemented with JavaScript BigInt: the input's own digit count is used as its width, `~value` is masked with `(1n << width) - 1n` (as `BigInt(1)`, since this repo's ES2017 target doesn't support `1n` bigint literals), and the masked result is padded back to that width.
Binary NOT Calculator Use Cases
- Building a 'clear these bits' mask from a 'set these bits' mask
- Teaching or demonstrating the NOT logic gate using concrete multi-bit binary examples
- Cross-checking a manually-computed bit-flip result
Common Mistakes
- Assuming NOT computes the arithmetic negative of the value, when it only flips bits structurally.
- Forgetting that the output width always matches the input's own digit count, so a short input produces a short output even if you meant a wider register.
Tips
- Apply NOT twice to the same value as a quick sanity check; you should always get back the original value.
- Use the Binary AND Calculator afterward if you need to apply the resulting complement/mask to another value.