Cast Any → INT / STRING / FLOAT
One input in, three typed outputs out — stop fighting ComfyUI's type system
- value
- int
- string
- float
ComfyUI's type system is strict, which is mostly a feature - and occasionally a wall. This node is a battering ram for that wall. It accepts a value that can arrive as a STRING, an INT, or a FLOAT, and hands you all three interpretations out: an int output, a string output, and a float output. Whatever type downstream wants, there's a port for it.
The practical pain it solves: nodes like advanced calculators or indexers hand you a number that's technically a STRING, and the next node demands an INT, and the wire won't connect. Or you have a float that needs to become a string for a prompt. This node converts once and lets you grab whichever type you need without a chain of converters. It's the "universal adapter" node, and it's the one you stop noticing because it just works.
What it needs
- value - accepts STRING, INT, or FLOAT. A widget default of
"0"and force-input enabled, so it works both as a typed-in value and a wire connection.
Three outputs:
- int - the value as an integer.
- string - the value as a string.
- float - the value as a float.
How the conversion behaves
The code parses the input to a float and derives the other two from it, so "3.7" gives int 3 (truncated, not rounded), string "3", and float 3.7. Watch that: the string output is the integer's string, not a re-print of the original. If you feed it 3.7 and grab the string output, you get "3", not "3.7". That's the one gotcha that trips people up, because the input and output are both named "string."
If the input can't be parsed as a number at all, you get 0 across all three outputs instead of a crash. Safe, but it means a typo silently becomes zero - worth remembering when you're debugging a "why is this suddenly 0" moment.
Where it fits
Pair it with the pack's Advanced Calculator, or any node that hands you a numeric string and any downstream that demands a typed number. It's also handy mid-workflow when a node only accepts INT but your source is a FLOAT that's really an integer in disguise (batch counts, indexes, sizes). One node, one connection, three types available - keep it on your palette for the inevitable type mismatch.
Install
Part of Vantage-Nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/vantagewithai/Vantage-Nodes.git
pip install -r requirements.txt
or ComfyUI Manager → search "Vantage-Nodes" → Install → restart.
Common issues
- String output says "3" when I gave it "3.7" - by design: the string output mirrors the integer output. Use the float output (or format elsewhere) if you need the fractional part.
- Everything becomes 0 - the input didn't parse as a number. Check for stray characters or empty strings.
- "3.9" becomes 3 - truncation, not rounding. If you need rounding, do it in a calculator node first.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | STRING,INT,FLOAT | 0 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| int | INT | — |
| string | STRING | — |
| float | FLOAT | — |