ComfyUI Node

Multiply

Multiply — scaling anything by anything, without the type dance

By aesethtics·Created about a year ago·Updated about a year ago· 1
Multiply
    • int_result
    • float_result
    float_a1.00
    float_b1.00
    int_a1
    int_b1

    Multiplication is the workhorse of ComfyUI math. You're scaling a resolution, adjusting a strength, or computing a derived step count - and usually you're doing it across mismatched types. This node takes two float inputs and two int inputs and multiplies them all together, returning the result as both an INT and a FLOAT. It's the "scale this number" node from the Utilitools pack, and it does that one job without any surprises.

    All four inputs are optional: float_a, float_b, int_a, int_b - each defaulting to 1 (not 0, which is the detail that matters). Because they default to 1, leaving an input unconnected doesn't zero out your product. Wire in float_a only and you get exactly that value out. That's the design you want for a scaling node: it's a 1×1×1×1 that becomes a real calculation the moment you feed it something.

    How it works

    The mechanism is a single multiplication of all four inputs - float_a * float_b * int_a * int_b - then both an int and float version of the result. The int output truncates toward zero, so 1.5 * 2 yields 3 on the int side and 3.0 on the float side. When you're computing something like base_width * 1.5 for a upscale pass, grab the float output and feed it wherever decimals are welcome; the int output is there for fields that demand whole numbers.

    The classic use: a "scale factor" pattern. Put a Constant Float in as the multiplier and you've got one slider controlling how much everything downstream scales. Multiply a denoise strength by a seed offset, multiply a CFG for a two-pass setup - it's the same shape every time, and this node makes the shape one box instead of two.

    Gotchas

    The defaults being 1 cuts both ways. It means a disconnected Multiply outputs 1, not 0 - which is correct behavior but can mask a missing wire if you expected a zero baseline. The int output truncates rather than rounds, so if you're doing resolution math and need exactness, use the float output and convert deliberately. And this node is multiplication only - the pack's Calculator is where you go for anything involving precedence or multiple operations in one expression.

    Installing it

    Same routine as every Utilitools node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/aesethtics/ComfyUI-Utilitools
    

    or search "Utilitools" in ComfyUI Manager and restart ComfyUI. It's under Utilitools → Math. No dependencies, no model downloads - the entire pack is pure Python with nothing extra to install. It's not the kind of node that has a community conversation around it, because it's not supposed to. You wire it, it multiplies, you move on.

    CategoryUtilitools/Math

    Inputs (4)

    NameTypeDefaultDescription
    float_aoptFLOAT1.00
    float_boptFLOAT1.00
    int_aoptINT1
    int_boptINT1

    Outputs (2)

    NameTypeDescription
    int_resultINT
    float_resultFLOAT