What Are Compare and Subtract Modes?
Every Redstone Comparator has a rear input, two side inputs (left and right), and a front output marked by the arrow on top of the block. At the front tip of the arrow sits a single miniature redstone torch. Using the comparator toggles this front torch between two modes:
- Comparison Mode (Front Torch Off/Down): The default state when placed. The comparator lets the rear signal pass through unchanged unless a side input is strictly stronger than the rear input, in which case the output drops to 0.
- Subtraction Mode (Front Torch On/Up): The comparator takes the rear signal strength and subtracts the strongest side input from it, outputting the difference.
If neither side receives power, both modes behave identically: the comparator simply maintains the rear input's exact signal strength and outputs it from the front after a 1 redstone tick (2 game tick) delay.
Exact Rules and Math Formulas
A comparator always evaluates whichever side input (left or right) has the higher signal strength. Not every redstone component can power a comparator from the side; side inputs are only accepted from redstone dust, a block of redstone, a redstone repeater, another redstone comparator, or observers in specific scenarios.
1. Comparison Mode Rules
In comparison mode, the rear input is compared against both sides using this formula:
output = rear × [left ≤ rear AND right ≤ rear]
- If either the left or right side input is greater than the rear input, the comparator outputs
0(turns off). - If neither side input exceeds the rear input (meaning the sides are less than or equal to the rear), the comparator outputs the exact rear signal strength.
2. Subtraction Mode Rules
In subtraction mode, the higher of the two side inputs is subtracted from the rear input:
output = max(rear − max(left, right), 0)
- Example A: Rear is
9, left side is5, right side is2. The stronger side is5. The output ismax(9 − 5, 0) = 4. - Example B: Rear is
4, left side is6, right side is7. The stronger side is7. Since signal strength cannot be negative, the output ismax(4 − 7, 0) = 0.
Worked Example: Building a Subtraction Comparator Clock
One of the quickest ways to see subtraction mode in action is building a toggleable 1-tick comparator clock:
- Place a Redstone Comparator on a solid block.
- Interact with the comparator once so its front miniature torch pops up and lights up (subtraction mode).
- Place three pieces of redstone dust: one directly in front of the comparator output, one to the side of that dust, and one directly adjacent to the comparator's side input so the front output loops back into the side.
- Place a lever behind the comparator (or leading into the rear input with dust) and flick it on.
How it works step-by-step: The lever feeds signal strength 15 into the rear. Initially, the side input is 0, so the comparator outputs 15 − 0 = 15 after 1 redstone tick. The output dust loops back to the side input, losing 2 signal strength over the dust path and hitting the side at strength 13. One tick later, the comparator calculates 15 − 13 = 2 and drops its output to 2. Because a strength 2 signal dies out before reaching the side input (which drops to 0), the next tick outputs 15 − 0 = 15 again, creating a rapid oscillating pulse.
How Players Use Both Modes in Redstone
- Item Sorters (Compare or Subtract): Container outputs read by a comparator produce a specific signal strength based on fullness. By feeding a known signal strength (such as from a lectern or another container) into the side input, players can trigger a hopper lock only when a container reaches an exact item threshold.
- Signal Strength Gates (Compare Mode): Because compare mode preserves the exact rear signal strength until a side input overtakes it, it acts as a lossless analog transistor—allowing a signal of strength 1 to 14 to pass through or be completely blocked by a 15-strength override line.
- Pulse Faders / Decay Circuits (Compare Mode): A two-comparator loop plays on signal preservation to slowly step down signal strength by 1 every loop cycle, extending a brief button press into a long timer.
- Rapid Clocks and Analog Math (Subtract Mode): Subtract mode enables compact rapid clocks for dispensers and droppers, as well as analog wire encoding where exact signal differences control contraptions at a distance.
Common Mistakes and Quirks
- Equal Signals in Compare Mode: A very common misconception is that equal rear and side signals turn off a comparator in compare mode. In reality, if the rear is
8and the side is8, compare mode still outputs8. To output0when both inputs are equal, you must switch to subtraction mode (8 − 8 = 0). - Invalid Side Inputs: Trying to power a comparator's side directly with a lever, button, redstone torch, or container will do nothing. Always run a piece of redstone dust, a repeater, another comparator, or a redstone block into the side.
- 1-Tick Pulse Blindness: Comparators check their power state before their scheduled tick updates. Because of this, they usually ignore 1-tick fluctuations—treating a 1-clock as always off from the side and always on from the rear.
- Overpowering Solid Blocks (Java Edition): You can measure a container through an opaque block, but if that opaque block is powered to signal strength
15, the comparator will read15regardless of how few items are inside the container.
