🔄 Type Converter
The type wrench node
- any
- string
- int
- float
- boolean
ComfyUI is strict about types, and that strictness is most of its charm - until you have a number sitting in a STRING socket and a text field that wants an INT. The 🔄 Type Converter exists to bridge exactly that. You plug anything into its single any input and it converts it in all four directions at once, giving you four outputs: string, int, float, and boolean. You wire the ones you need and ignore the rest.
The conversion rules are the part worth memorizing, because they're opinionated in ways that will otherwise surprise you mid-workflow:
- String - everything becomes
str(). No surprises here. Tensors get a nice shape string (Tensor(1×512×512×3)), latents reportLatent(batch×ch×h×w), a single-element tensor becomes its scalar. - Int / Float - real numbers convert directly; strings get parsed (
"42"→ 42); lists, dicts, and multi-element tensors become their length or element count. So an IMAGE tensor with 1000 pixels converts to int1000, which is usually not what you meant - know that going in. - Boolean - this one has teeth. The string
"false","0","no","none","null", or empty string all convert to False (case-insensitive); a single-element tensor becomesbool(value.item()); everything else is Python truthiness. So"False"(with capital F) is actually True, because it's not in the lowercase list. That's a real gotcha if you're feeding it user-typed strings.
The node is an output node, which means it always runs and it shows you what it did: the header displays the detected original type plus all four converted values, so you can sanity-check a conversion before you trust it downstream. If you see original_type: STRING when you thought you were feeding a number, that alone saves you a debugging session.
Why would you reach for this instead of ComfyUI's built-in int/float conversion widgets? Because those only do one conversion per node and mostly handle numeric inputs. Converter is the fallback-everything node: a prompt string that might be empty, a seed that arrived as text, a batch count pulled off a tensor - all of it becomes the four primitives in one place. It's also a genuinely handy diagnostic, since the type detection (IMAGE vs MASK vs LATENT vs DICT vs LIST, including list-of-tensor vs list-of-string) is useful information on its own.
The mechanism is a straight dispatch on Python type: booleans are checked before ints (because in Python True is an int), tensors by their number of dimensions, dicts by whether they carry a samples key (that's the ComfyUI LATENT convention). None of it is exotic, which is the point - the value is having all of it in one node.
One design note: Converter runs every time (the pack's standard IS_CHANGED → NaN always-rerun trick), and it's marked as an output node, so it'll force its upstream chain to execute each run. It's cheap, so that's rarely a problem - but don't leave one wired to an expensive loader if you're trying to shave seconds.
Installation is pack-level. ComfyUI Manager → search "ComfyUI-Logic-nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/playboy-dongan/ComfyUI-Logic-nodes
Restart, find it under ⚡ Logic. No models, no extra deps (just torch, which ComfyUI already has). The README's clone example uses a shorter repo name - if that 404s, use the -nodes URL above.
It's not the flashiest node in the pack, but "I have an anything, I need a number" happens constantly, and this is the fastest answer to it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| any | * | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| string | STRING | — |
| int | INT | — |
| float | FLOAT | — |
| boolean | BOOLEAN | — |