Nodes/ComfyUI/Convert Number
ComfyUI Node Runs on cloud

Convert Number

One node to cast anything to a number — int, float, string, bool

By Comfy-Org·Created 4 years ago·Updated 21 days ago· 121,575
Convert Number
  • value
  • FLOAT
  • INT

ComfyUI is strict about types, which is usually a good thing - a string won't silently become a number and wreck your denoising strength. But it means you end up hunting for the right converter when a node hands you a string and the next node wants a float. Convert Number is the one-stop fix: it takes an int, float, string, or boolean, and hands you both a float and an int on the other side. You pick the one you need.

It ships with ComfyUI core and is a 2026 addition - the replacement for the old scatter of int-to-float, float-to-int, and string-to-number nodes that every workflow accumulated.

How it works

The conversion rules are the sane defaults you'd guess, and it's worth knowing the exact ones because the string path has a subtlety:

  • Boolean → 1.0 / 1 for true, 0.0 / 0 for false.
  • Integer → the same value as a float, unchanged as an int.
  • Float → stays as the float; the int output truncates the decimals (no rounding).
  • String → parsed as a number. "3.5" gives a float of 3.5 and an int of 3; "42" gives both as 42.

The subtlety is in that last line: a string like "3.5" produces an int of 3 - truncation, not rounding. And a string that can't be parsed at all raises an error rather than guessing, which is exactly what you want from a conversion node.

Inputs and outputs

One input, value, which accepts an int, float, string, or boolean. Two outputs:

  • FLOAT - the numeric value as a float.
  • INT - the numeric value as an integer.

Both outputs are always live, so you can wire one value into a float input and the same converted value into an int input simultaneously. That's the design win: one conversion, both flavors available.

Where people get burned

The truncation thing catches everyone once. "3.9" → INT of 3, and if you needed 4 you've got a subtly wrong step count or strength. If rounding matters, run the float through a round operation first, or just use the float output and let the target node do its own thing.

Second: empty strings raise an error, and so do strings with junk in them like "12px". If you're converting strings that came from a model or a file, trim and validate upstream; this node is a converter, not a sanitizer.

Third: don't use it as a crutch for every type mismatch. Some mismatches are bugs worth fixing at the source - a node producing a string when you expected a number is a symptom. But when you genuinely have a string from a text box or a filename, this is the clean way through.

Categoryutilities

Inputs (1)

NameTypeDefaultDescription
valueINT,FLOAT,STRING,BOOLEAN

Outputs (2)

NameTypeDescription
FLOATFLOAT
INTINT