Free tool

Comparator Hysteresis Calculator

Give it the trip points you want and it returns real E-series resistors, the reference voltage those thresholds actually imply, and the thresholds you will measure with the reference you have — then checks the result against the input noise you expect.

R1 (input)
R2 (feedback)
Reference needed
Hysteresis
You asked forWith real parts and your referenceError
Upper trip VTH
Lower trip VTL
Hysteresis band

Runs entirely in your browser. Nothing is uploaded, stored, or sent anywhere.

Why a comparator without hysteresis is a mistake

A bare comparator has enormous gain and no memory. When the input sits near the threshold — which is exactly where it sits during any slow transition — a few millivolts of noise crosses the trip point repeatedly, and the output produces a burst of edges instead of one. On a slow ramp that burst can be hundreds of transitions.

Downstream that is rarely harmless. A counter counts them, an interrupt fires on each, a relay buzzes, a motor controller sees a stream of contradictory commands. It is also intermittent and load-dependent, which makes it a genuinely unpleasant fault to chase after the boards are built.

Hysteresis fixes it by making the threshold depend on the current output state: once the output flips, the trip point moves away from the input, so noise has to be larger than the hysteresis band to flip it back.

The two knobs are independent, and that is the useful part

Non-inverting: Vhyst = (R1/R2) · (VOH − VOL), centre set by Vref
Inverting: Vhyst = Rref/(Rref+Rf) · (VOH − VOL), centre set by Vref

The width of the band depends only on the resistor ratio. The position of the band depends only on the reference. They do not interact, which means you can design them separately — set the reference for where you want to trip, then choose the ratio for how much noise immunity you need.

It also means scaling both resistors together changes nothing electrically. That freedom is what lets you move the network impedance up to stop loading the source or the output, or down to reduce the offset caused by input bias current flowing through it.

What this tool does that the others do not

Open-drain outputs need care

With an open-drain comparator, VOH is not a property of the comparator at all — it is set by the pull-up resistor. And the feedback resistor is a second path to that same node, so the pull-up and the feedback network form a divider and the real VOH sits below the rail. Feed the loaded value into the calculator, not the supply voltage, or the hysteresis will come out smaller than predicted.

The same node also has to charge whatever capacitance is on it through the pull-up, so an open-drain output is slower on the rising edge — which on a fast comparator can be the dominant limit on how quickly the feedback actually arrives.

How much hysteresis

Enough to exceed the noise, with margin. Two to three times the peak-to-peak noise is a common starting point, and the noise to use is the noise at the comparator input — including supply coupling and whatever the input filter did not remove, not just the sensor's own datasheet figure.

The cost of more hysteresis is accuracy: a 200 mV band means the trip point is uncertain by 200 mV depending on which way you arrived. For a threshold detector that is usually irrelevant; for a precision level measurement it may not be, and the answer there is a filter before the comparator rather than a wider band.

DC only. This assumes the feedback settles faster than the input moves, which is true of almost every real design but not of very fast comparators with slow feedback networks. Nothing here models propagation delay, input offset voltage (add it to the threshold error), or the input bias current flowing through your network — the op-amp error budget covers that last one, and the arithmetic is the same for a comparator.

More free tools

Each of these runs entirely in your browser. Nothing is uploaded, stored or sent anywhere, and none of them needs an email address.

Via stub resonance →
Stub length to its quarter-wave null, and whether the link needs backdrilling.
Resistor divider →
E-series values, worst-case output range with stacked tolerances, and dissipation.
Op-amp error budget →
Every DC error term referred to the input, ranked, and converted to ADC LSBs.
Signal chain noise →
Per-stage noise referred to the input, the stage that sets the floor, and ENOB.

See all 49 engineering tools →

Stay in touch

New tools and notes, once a month at most

We add tools here fairly often and write up the things worth writing up — a stackup that behaved oddly, a standard that turned out to be obsolete, a calculator that was quietly wrong. Join and you get told when something new lands.

One email a month at the very most, and usually less. No drip sequence, no sales cadence, no sharing your address with anyone. Unsubscribe whenever you like.

Join the list →

Talk to us about a board design review →