π§ Simple Math
Simple Math (ComfyUI Essentials)
- a
- b
- c
- INT
- FLOAT
Sometimes you just need to multiply a width by 1.5, or subtract 64 from a value, or take half of whatever the input image's height is - and stringing together ComfyUI's individual add/multiply nodes for that is genuinely painful. Simple Math lets you type a math expression as text and get the answer out. It's one of the highest-value little utilities in the Essentials pack, which is why it consistently pulls search traffic well above its weight.
Why you'd reach for it
ComfyUI has no native "evaluate this expression" node, so any real arithmetic means chaining primitive math nodes into a spaghetti of little boxes. Simple Math replaces that whole chain with one field. The everyday use is computing dimensions - "make the latent 1.5Γ the input width, snapped down," "steps = base + 10" - where you want the number derived from other wires rather than hardcoded. Anywhere a downstream node takes an INT or FLOAT and you'd otherwise do the math in your head, this node does it in the graph, so it updates automatically when the inputs change.
How it works
You write an expression in the value field using the variables a, b, and c, then wire numbers into those inputs. So a * 1.5 scales input a; a + b adds two wires; a / 2 halves one. It parses the string, plugs in the values, and evaluates. Because it runs at graph time, changing an input re-computes the result - it's a live formula, not a constant.
Inputs and outputs
The required input is value, the expression string. The optional inputs a, b, and c are the variables - they accept effectively any numeric type (the node is deliberately loose about what you plug in). Two outputs: INT and FLOAT, the same result in both forms. That dual output is the practical bit - most nodes that take a size or count want an INT, while strength/denoise-type inputs want a FLOAT, so you grab whichever the target expects without a conversion node.
Installing it
From ComfyUI Essentials by cubiq (Matteo Spinelli - the IPAdapter author, Latent Vision on YouTube). ComfyUI Manager: search ComfyUI Essentials, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/cubiq/ComfyUI_essentials
then restart. It's π§ Simple Math under essentials/utilities, class SimpleMath+. The pack has been maintenance-only since April 2025, but a math evaluator doesn't need updates.
Common issues
The INT output is where people get surprised: a float result gets converted to an integer, so 5 / 2 gives you 2 on the INT wire and 2.5 on the FLOAT wire - pull from FLOAT if you need the fractional part, or add rounding to your expression. Stick to the documented a/b/c variables; referencing anything else in the string will fail. And keep it, well, simple - this is arithmetic on a few numbers, not a scripting environment. If you find yourself wanting two related results from the same inputs (width and height), reach for Simple Math Dual instead of two separate nodes.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| value | STRING | β | |
| aopt | * | 0 | β |
| bopt | * | 0 | β |
| copt | * | 0 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | β |
| FLOAT | FLOAT | β |