to STRING
The node that lets you print, name, and debug anything
- input
- STRING
Half of ComfyUI's fiddliest moments come down to types not matching: a node needs text, and you're holding a number. to STRING is the shortest path from "anything" to "text." Feed it a float, an INT, a boolean, even a list - it comes out as a string you can show, save, or paste into a filename.
It's part of Basic data handling, StableLlama's zero-dependency utility pack, and it's the cast node you'll reach for constantly once you start building workflows with any logic in them.
How it works
One line: str(input). Whatever arrives in input (*) gets Python's string representation. That means:
42→"42",3.14→"3.14",True→"True"- a list
[1, 2]→"[1, 2]" - an image or model object → whatever its
__str__says (often a memory address - rarely useful, but harmless)
Nothing is configurable; the whole node is the conversion. The output STRING plugs straight into any text input, which is where the practical value lives: you can take a seed or a step count, stringify it, concatenate it into a prompt tag, or feed it to a filename template so your saved images carry the parameters that made them.
Where it shines
- Debugging: stringify a value and pipe it into any text-display node to see what's actually flowing through a wire.
- Filenames and metadata: turn the batch size or CFG into text so a filename builder can incorporate it.
- Interfacing: a lot of tools (APIs, path nodes, the pack's own
save STRING to file) want text, and this is the adapter.
Installing it
ComfyUI Manager → search "Basic data handling", or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart. No dependencies, no models.
Common issues
- "I cast my number and it changed." A float cast to string keeps its exact digits -
3.10may stringify as"3.1". If you need specific formatting (decimals, padding), run it through a format node first; plainstr()doesn't format. - "It's a memory address, not my value." Some objects (like tensors or loaded models) don't stringify to anything readable. Cast before the object becomes opaque, or extract the value you care about first.
- "I can't use it as a number anymore." Right - it's text now. If the downstream node needs an INT or FLOAT, chain a cast back (
to INT,to FLOAT) after the string work is done.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |