Find Multiple Of
Snap any number to a multiple of 8, 16, 64
- INT
Diffusion models are picky about dimensions. Most want width and height divisible by 8, some by 16, some latent tricks want 64. Feed a model an odd number and you get errors, or worse, silent cropping and stretched output. Find Multiple Of is the tiny math node that guarantees clean numbers: give it a value and a divisor, and it rounds to the nearest multiple. It's the node you drop between "some computed dimension" and "the latent size input" so a value like 813 becomes a tidy 816 (or 808, your call) before it ever reaches a node that would choke on it.
The classic use is dynamic resizing. You're scaling an image by some ratio, or deriving a target size from a loaded video's dimensions, and the arithmetic hands you a fractional or off-grid number. Rather than eyeball it, you snap it to a multiple and move on. It also comes up in tiled workflows and anything where a stride or block size has to divide evenly.
How it works
Plain integer rounding to a multiple, with a choice of how to round. The rounding mode decides which way an in-between value goes, which matters more than it seems when you're near a memory ceiling - rounding a dimension up can push you into an OOM that rounding down would have avoided.
The inputs and outputs that matter
value- the number to snap.multiple- what to snap it to (minimum 1). Use 8 for most models, 16 or 64 where a workflow demands it.rounding- how to break ties and which direction to go:nearest- closest multiple (the default, and what you usually want).down- never exceed the value; safest for staying under a VRAM budget.up- never go below; use when you must meet a minimum size.bankers- round-half-to-even, the statistically unbiased tie-break, if you're accumulating many roundings and don't want them to drift.
The output is a single INT - the snapped number, ready for a latent size, a resize target, or any integer input downstream.
How to install it
ComfyUI Manager, search JNodes, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/JaredTherriault/ComfyUI-JNodes
pip install -r ComfyUI-JNodes/requirements.txt
No models.
Common issues & troubleshooting
Still getting a dimension error. Check you snapped to the multiple the model actually requires. 8 is the common one, but some architectures and some latent operations want 16 or 64 - snapping to 8 won't satisfy a node that needs 64.
A resize came out slightly off from what I expected. That's the rounding doing its job - an off-grid target got moved to the nearest valid multiple. If the direction matters (you never want to exceed a size, or never want to fall short), set down or up explicitly instead of nearest.
Rounded up into an out-of-memory. Near a VRAM ceiling, up can be the straw that breaks it. Use down when the priority is fitting in memory rather than hitting an exact minimum.
Why bankers? Only relevant if you're rounding a lot of values and want the tie-breaking to be unbiased overall. For a one-off dimension it behaves like nearest most of the time - don't overthink it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| value | INT | 0 | — |
| multiple | INT | 1 | — |
| rounding | COMBO | nearest | 4 options: nearest, down, up, bankers |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |