Simple Number Counter ⏲️
A counter node that remembers where it left off
- number
- float
- int
ComfyUI doesn't have a native for-loop, and it doesn't remember state between runs unless something is explicitly built to remember it. That second part is what this node is for. Simple Number Counter holds a running value in memory and moves it every time you queue the workflow - up, down, or toward a target - instead of you sitting there editing a widget by hand between runs. It's the building block people reach for to number saved outputs, step a seed-like value, or drive a fixed number of automated passes, the same job that things like Impact Pack's Queue Trigger (Countdown) or WAS Suite's batch-index nodes do in their own corners of the ecosystem.
How it works
The node keeps its current value across queue runs - that's the whole trick, and it's the only way a "counter" node can mean anything, since start, stop, and step are just static settings you configure once. Each time the graph runs, it advances the stored value according to mode, then hands it back out. increment and decrement just keep adding or subtracting step forever; increment_to_stop and decrement_to_stop head toward stop and hold there once they arrive, which is what you want for a fixed number of iterations instead of an endless crawl. Notice there's no negative-step option - step's minimum is 0 - so to count downward you pick decrement mode rather than typing a negative number.
The inputs and outputs that matter
mode-increment,decrement,increment_to_stop,decrement_to_stop. This decides the whole behavior; everything else just parameterizes it.start/stop/step- where the count begins, where it stops (for the_to_stopmodes), and how much it moves per run.reset_bool(optional) - wire a boolean/number into this to snap the counter back tostarton demand. Without it, the only way to reset is restarting ComfyUI, since the value lives in memory, not in the workflow file.number_type-integerorfloat, which just picks which flavor of the value is the "natural" one for this run.
Outputs are number, float, and int - the same current value in three types at once, so whatever you're wiring it into, you grab the matching socket instead of hunting for a convert node.
Installing it
ComfyUI Manager: search ComfyUI-Line-counter - yes, the pack name is about line counting, but this node rides along in the same package - install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ChrisColeTech/ComfyUI-Line-counter.git
Restart ComfyUI. No model downloads, no Python dependencies to speak of - this is plain file/state logic, not anything GPU-adjacent.
Worth knowing up front: the pack's own README only documents the two file-counting nodes (Text File Line Counter and Directory File Counter). Simple Number Counter and Text File Line Reader ship in the same repo but aren't mentioned there - that's not a sign anything's broken, just a README that lags the actual node list.
Where people get tripped up
The state is the whole point and also the thing that confuses people first: if you queue the workflow twice and the number keeps climbing instead of resetting, that's correct - it's supposed to persist. If you wanted it to start over, you needed reset_bool wired up, or a ComfyUI restart to clear the in-memory value.
Second, with three outputs carrying the same value in different types, it's easy to grab the wrong socket out of habit and wire float somewhere that really wanted a whole number, or vice versa - check which output you actually dragged from if a downstream node is behaving oddly, rather than assuming the counter itself is wrong.
And if you're trying to build a loop - say, walk through N files one per run - this node alone doesn't drive the queue for you. Pair it with something that actually stops or repeats the queue count (Impact Pack's Queue Trigger is the common one) or with increment_to_stop and manual reruns; Simple Number Counter tracks the number, it doesn't decide how many times ComfyUI executes.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| number_type | COMBO | 2 options: integer, float | |
| mode | COMBO | 4 options: increment, decrement, increment_to_stop, decrement_to_stop | |
| start | FLOAT | 0.00-18446744073709550000–18446744073709550000 | — |
| stop | FLOAT | 0.00-18446744073709550000–18446744073709550000 | — |
| step | FLOAT | 1.000–99999 | — |
| reset_boolopt | NUMBER | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| number | NUMBER | — |
| float | FLOAT | — |
| int | INT | — |