NOR calculator
Apply NOR, AND, OR, or XOR to two fixed-width integers and inspect the result in binary, signed decimal, unsigned decimal, and octal.
Inputs
Use whole numbers that fit the selected fixed-width representation.
NOR equals NOT applied to the bitwise OR result.
Controls the mask, leading zeros, and signed decimal range.
The same data type is applied to both input fields.
Enter an integer from 1 to 32.
Binary digits only; up to 4 bits. Leading zeros are optional.
Binary digits only; up to 4 bits. Leading zeros are optional.
Live results
All formats describe the same fixed-width result pattern.
Binary result
0010
NOT (1001 OR 0101), limited to 4 bits
Signed decimal
2
Unsigned decimal
2
Octal result
2
Set bits
1 of 4
NOR result is binary 0010, signed decimal 2.
Output bits
Each cell is keyed to its bit position, from most significant to least significant.
Bit-by-bit detail
The operation is applied independently at each fixed-width bit position.
| Bit position | Number 1 bit | Number 2 bit | NOR output |
|---|---|---|---|
| 3 (MSB) | 1 | 0 | 0 |
| 2 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 0 (LSB) | 1 | 1 | 0 |
MSB means most significant bit; LSB means least significant bit. Binary inputs are left-padded with zeros before the operation is applied.
How to use this NOR calculator
What this calculator does
This calculator applies a selected bitwise logic operation to two integers inside a fixed-width bit mask. Its main purpose is to evaluate NOR, defined as the inverse of OR, while also making AND, OR, and XOR available for comparison. It reports one exact bit pattern in several representations; it does not simulate voltage levels, propagation delay, fan-out, or other physical circuit behavior.
When to use it
Use it to check digital-logic exercises, verify low-level programming masks, compare signed and unsigned interpretations of the same bits, or inspect how a gate acts at every bit position. The NOR gate explanation and truth table provides useful background on why only the 0 – 0 input pair produces a 1 for NOR.
How to calculate
- The calculator opens with a complete 4-bit demonstration: Number 1 is 1001, Number 2 is 0101, and the operation is NOR. The example result and its Excel workbook are immediately available.
- Choose Binary representation. Select 4-bit, 8-bit, 12-bit, 16-bit, or Other. If you choose Other, enter a Custom bit width from 1 through 32.
- Choose Data type, then replace Number 1 and Number 2 with valid integers in that base. Results update live.
- Choose Bitwise operation and read Binary result first. Then compare Signed decimal, Unsigned decimal, Octal result, Set bits, Output bits, and the Bit-by-bit detail table.
- Select Download Excel to export the current validated model. Reset clears the demonstration and entered values; after Reset, Excel export stays disabled until both numbers form a complete valid state again.
Input guide
Binary representation is required and determines the exact number of output bits. A 4-bit example accepts four or fewer binary digits and decimal values from – 8 to 7. A larger width preserves more leading bits. A common mistake is selecting too few bits for the intended value.
Custom bit width is required only when Other is selected. Enter a plain base-10 integer from 1 to 32, such as 10. Fractions, separators, signs, and scientific notation are rejected. Increasing the width adds leading positions and changes the signed range and NOR mask.
Data type is required and applies to both numbers. Binary accepts only 0 and 1, octal accepts 0 through 7, and decimal accepts a signed base-10 integer. Prefixes such as 0b or 0o are not accepted. Do not paste decimal commas or grouped numbers.
Number 1 and Number 2 are required whole numbers. For binary or octal, they are treated as unsigned bit patterns that must fit the chosen width; for decimal, they must fit the width's signed two's-complement range. In the startup example, 1001 and 0101 are valid 4-bit patterns. Leading zeros are allowed but not required.
Bitwise operation is required. NOR returns 1 only when both bits are 0; AND returns 1 when both are 1; OR returns 1 when either is 1; XOR returns 1 when the bits differ. Changing the operation does not change the input values or width.
Output guide
Binary result is the exact fixed-width output and is the primary result. Signed decimal interprets its top bit as the sign bit, while Unsigned decimal treats every bit as magnitude. Octal result expresses the same pattern in base eight. Set bits counts 1s in the output. The formula line beneath Binary result restates the selected operation and fixed-width mask. The summary pills repeat the active width, input type, operation, and validation status.
Output bits shows every result bit by position. The Bit-by-bit detail table lists Bit position, Number 1 bit, Number 2 bit, and the selected operation's output. These are exact identities derived from the same model, not forecasts or recommendations. Zero means no output bits are set; a negative signed decimal means the output's most significant bit is 1.
Worked example
With 4 bits, Number 1 = 1001 and Number 2 = 0101. OR first produces 1101. NOR inverts those four bits only: NOT 1101 becomes 0010. Therefore the first-open Binary result is 0010, Signed decimal is 2, Unsigned decimal is 2, Octal result is 2, and Set bits is 1 of 4.
How fixed-width NOR works
For each bit position, NOR is written as NOT (A OR B). The width matters because inversion must be limited to a finite mask. Without a mask, a software language may conceptually extend sign bits or force a built-in machine width. This calculator creates a mask of exactly 2n – 1 for n bits, applies the operation, and then discards every bit outside that mask.
where mask = 2bit width – 1.
The same finite pattern can represent two different decimal values. Unsigned interpretation ranges from 0 to 2n – 1. Signed two's-complement interpretation ranges from – 2n – 1 to 2n – 1 – 1. For a formal logic perspective, LibreTexts describes the NOR connective as NOT of logical OR.
Interpretation and common mistakes
Do not compare the signed decimal result with the unsigned result as though one were more correct. Both are legitimate interpretations of the identical stored bits. Also avoid assuming that adding a wider representation changes the low-order operation: it preserves those bits but adds leading positions, which can materially change NOR because new 0 – 0 pairs become 1s.
Programming languages may impose their own bitwise width. For example, ordinary JavaScript number bitwise operators use 32-bit integer representations, as summarized in the MDN guide to bitwise operators. This calculator explicitly applies the chosen 1 – 32 bit mask so the displayed width remains the governing rule.