ComfyUI Node

max

The 'pick the bigger one' node that ends your clamp chains

By StableLlama·Created about a year ago·Updated 4 days ago· 48
max
  • value1
  • value2
  • *

max takes two numbers and returns the larger. That sounds almost too boring to warrant a node, until you realize how often ComfyUI math is really "keep this value from dropping below X" - and that's exactly what max(value, floor) does. The max node from Basic data handling is your clamp-from-below, your "don't go under this", your safety floor, all in one widget.

It's the partner of min (clamp from above). Together they're the two most used comparison-math nodes in any serious workflow, because they're how you bound a computed value without writing a conditional.

How it works

Under the hood it's Python's built-in max(). Two required inputs:

  • value1 - FLOAT or INT, default 0.
  • value2 - FLOAT or INT, default 0.

The output is the larger of the two. The node returns a * (wildcard) type, which means ComfyUI will let you wire it into either FLOAT or INT sockets - convenient when you're clamping a step count but your inputs came from float arithmetic.

The classic pattern: clamping

Say a scheduler computes a denoise value that can occasionally dip to 0.05, and your node downstream can't handle anything below 0.1. Wire max(value, 0.1) and you've got a hard floor. The same shape handles:

  • Batch size floors - max(computed, 1) so you never ask for zero tiles.
  • CFG or step lower bounds - prevent a workflow variable from underflowing.
  • Any "at least" constraint - that's the entire job of max, stated plainly.

Pair it with min for the full picture: min(max(value, lo), hi) is a clamp, and both halves come from this same pack.

A subtlety worth knowing

Because both inputs accept FLOAT or INT, the output follows whichever input is bigger - but as a float. If you need the result as a strict integer (say, feeding a step-count socket), floor it on the way out with the pack's floor node. It's the kind of type detail that only bites when you're deep in a workflow at 2am, and now it won't.

Installing it

Basic data handling is dependency-free - no models, no pip installs, which is the pack's whole quiet flex. ComfyUI Manager, search "Basic data handling", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart, and max lives under Basic/maths next to min.

For a node this simple, the only real advice is: don't rebuild it from MathFormula every time. max(a, b) is a function call you'd be typing anyway - as a node it's faster to place and self-documenting on sight.

CategoryBasic/maths

Inputs (2)

NameTypeDefaultDescription
value1FLOAT,INT0
value2FLOAT,INT0

Outputs (1)

NameTypeDescription
**