ComfyUI Node

IntToFloat

Fix a red wire between an INT output and a FLOAT input

By danTheMonk·Created about a year ago·Updated about a year ago· 14
IntToFloat
    • float_value
    int_value0

    You tried to wire a counter, a batch index, or a math node's output into something that wants a FLOAT, and ComfyUI wouldn't let you connect it. That's the entire reason IntToFloat exists. It takes a whole number in and hands you the same number back as a float - 42 becomes 42.0. Nothing else happens to it.

    This is the flip side of a complaint that shows up constantly on r/comfyui: people wiring two nodes that are obviously compatible to a human ("it's just a number!") and getting slapped with Return type mismatch between linked nodes: a, INT != INT,FLOAT. ComfyUI's graph validator treats INT and FLOAT as genuinely different socket types - different colors, no automatic coercion - even though under the hood they're both just numbers. Most of the time that strictness saves you from wiring a latent into a text box by accident. But it also means the moment you have an integer-producing node (a seed counter, an image-dimension read, a Batch Count, some math you did in an INT node) feeding into a float-only parameter - strength, denoise, a CFG multiplier, a scheduler value - you're stuck until something bridges the gap. IntToFloat is that bridge.

    How it works

    There's no logic to speak of. It reads an integer and casts it to a float of the same value. No scaling, no rounding, no clamping - an integer already is a whole number, so there's nothing to decide on the way out. If you're picturing a tiny Python function that does float(x) and returns it, you're picturing the whole node.

    Inputs and outputs

    Just one of each, and both are exactly what they sound like:

    • int_value (INT, default 0) - the integer you're converting.

    The output is a single float_value (FLOAT) carrying the same numeric value. Wire it straight into whatever float-typed input was rejecting your INT wire, and the connection goes green.

    Installing it

    This pack ships two nodes in one small extension - IntToFloat and its counterpart FloatToInt - so installing it gets you both. Via ComfyUI Manager, search for ComfyUI Int and Float Conversion Nodes (or the repo name, comfyui-int-and-float); install and restart. It's a small, low-profile repo, so if Manager's index doesn't turn it up, clone it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/danTheMonk/comfyui-int-and-float
    

    Restart ComfyUI. There's genuinely nothing else to it - no requirements.txt, no model downloads, no dependencies beyond ComfyUI itself and Python 3.7+. Both nodes land in the node menu under the Custom category.

    Common issues

    Honestly, there isn't much that can go wrong with a single-line type cast - that's kind of the point. The real question isn't "why did this break," it's "do I actually need this node." A few things worth knowing before you reach for it:

    • Check whether you need it at all. ComfyUI's handling of int-into-float connections has gotten a bit more forgiving in recent versions in some spots, so test the direct wire first. If the graph refuses it with a type-mismatch error, that's your cue to drop this in - not before.
    • It's a two-node pack, install once. If you found this node in a downloaded workflow and went looking for it specifically, know that FloatToInt (the reverse conversion, with rounding options) ships in the same repo - you don't need a second install for it.
    • If a workflow you downloaded shows this node as "missing," it's almost certainly just not installed rather than broken - this is a tiny, single-author utility pack that some Manager mirrors may not index reliably. A manual clone (above) resolves it every time.
    • If you already run a big kitchen-sink utility pack - WAS Node Suite, Impact Pack, rgthree, or similar - check there first. Those collections are large enough that they often already include an int/float converter buried somewhere, and adding a whole extra repo for a two-node pack is more clutter than it's worth if you've already got the equivalent.

    There's no failure mode beyond "the node isn't installed" or "you didn't need it." It converts a number to the same number in a different type, and that's all it will ever do.

    CategoryCustom

    Inputs (1)

    NameTypeDefaultDescription
    int_valueINT0

    Outputs (1)

    NameTypeDescription
    float_valueFLOAT