Type Converter
The glue that keeps ComfyUI's strict typing happy
- value
- converted
Type Converter takes any value and converts it to string, int, float, or boolean. The reason this node exists at all is one of ComfyUI's most annoying realities: the sockets are strongly typed. An INT port will not accept a wire from a STRING port, even when the value is obviously a number. A node that returns * (wildcard) or a JSON object often doesn't plug into a node expecting a plain string. Type Converter is the adapter that makes those mismatches go away.
You'll reach for it constantly, usually out of mild annoyance: an LLM node returned a number as text and something downstream wants a real INT; a math node handed you a float but the target wants an INT; a boolean from a compare needs to become the string "true" for a text-based conditional. Every one of those is a Type Converter moment. It's one of those unglamorous nodes that makes the difference between "this graph won't even connect" and "this graph runs."
How it works
- string - plain
str(value). Everything stringifies. - int - booleans become 0/1, strings parse via float first (so
"3.14"→3), floats truncate. No rounding anywhere. - float - booleans become 0.0/1.0, strings parse, ints widen.
- boolean - this is where the personality is. Strings
true/yes/1/on(case-insensitive) → True;false/no/0/offor empty → False; any other non-empty string → True. Numbers follow Python truthiness (0 → False, anything else → True).
The value input is a wildcard * socket, so it accepts anything, and the output_type dropdown picks the target. One output, converted, which adapts to whatever type you chose.
Gotchas worth knowing
Three behaviors, all grounded in the source, all likely to bite:
- int conversion truncates, it doesn't round.
"3.9"or3.9both become3. If you need rounding, do it before converting. - Unknown strings convert to True.
"banana"→True. The node only recognizes the explicit false set; anything else counts as truthy. If you're parsing user input into booleans, "maybe" silently becomes "yes." - Unconvertible input fails loudly, not silently.
"abc"→ int raises aValueError, which ComfyUI surfaces as a node error. That's actually good behavior - better a red node than a silently wrong number - but it means you can't assume conversion always succeeds.
Also note there are several more specific converters in the same pack (Int to Float, Float to Int, String to Int, String to Float, String to Boolean, Number to String). Those exist so graphs can name what they're doing; the generic one covers all of them if you don't want to hunt for the right specialist.
Installation
ComfyUI Manager → "DebugPadawan's ComfyUI Essentials", or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git
Restart ComfyUI. No models, pure Python, nothing extra to install for this node.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | * | — | |
| output_type | COMBO | 4 options: string, int, float, boolean |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| converted | * | — |