格式转换
The adapter for the socket that refuses to connect
- *
- 输出
You drag a wire from one node's STRING output toward another node's INT input and ComfyUI refuses the connection. That's the moment 格式转换 exists for. It's a one-job node: take anything, spit out string, int, float or boolean.
What's actually happening when a wire won't connect
The author's own README is refreshingly blunt about this: every core ComfyUI node declares INT/FLOAT/STRING/BOOLEAN inputs, and the backend converts between them automatically when you connect things. So for a stock graph you rarely need this node at all. It's for the other packs - ones that validate types strictly and won't let a STRING socket touch an INT widget, or that need a bool where you have an int.
That puts this node in an interesting spot relative to the ecosystem's long argument about type-erasing nodes. The community has a well-known allergic reaction to "Anything Anywhere"-style nodes that let you wire any output into any input regardless of type, because workflows built that way become undebuggable - a graph where everything can connect to everything tells you nothing when it breaks. This node is the narrow version of that idea: the input port is a genuine wildcard, but the output is whatever single type you chose, and the conversion is an explicit, visible Python cast. It doesn't hide a type error, it declares one.
The mechanism, which is literally four casts
* is ComfyUI's wildcard type - a string subclass that compares unequal to anything, so the port accepts literally any socket without a mismatch complaint. 格式类型 picks the target, and the body is str(anything), int(anything), float(anything), or bool(anything). The single output port 输出 is itself typed as a wildcard, which is what lets it plug into a converted input of whatever type you're aiming at.
That "it's just Python casts" detail is the whole troubleshooting guide, because Python's semantics are the trap:
int("3.7")raises.int(float("3.7"))gives you 3. If your upstream text node emits decimals and you ask for int, chain it through float first or round upstream.bool("false")is True. Any non-empty string is truthy in Python. If you're feeding text like"false"or"No"into a boolean, this node will happily tell you it's true. Same forbool("0").int("abc")raises and kills the run - there's no fallback, no default value. For a node this simple, that's the honest design, but it means a graph that runs fine until some branch emits unexpected text will fail hard rather than gracefully.float("1e3")works,float("1,3")doesn't. Locale separators are not handled.
The node is marked as an output node, so it always executes when it's in the graph - worth knowing if you're debugging why a branch you thought was cached re-ran.
Inputs and output
| Port | Type | Note |
| --- | --- | --- |
| * | any | tooltip: "接受任何类型的输入" - any socket will connect |
| 格式类型 | enum | string / int / float / boolean |
| 输出 | any (*) | the cast value, typed loosely so it connects onward |
That's the entire node surface. No hidden options.
Install
It ships in yanhuo-easy-use, the 16-node utility pack (category yanhuo, Chinese node titles, MIT licensed, version 1.3.1). ComfyUI Manager → search the pack title → install → restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/yanhuoxunxianren/yanhuo-easy-use
# restart ComfyUI
No pip install - the pack's pyproject.toml declares no dependencies at all, and the libraries it does import are the ones ComfyUI already ships (plus PyAV for its audio nodes). No model files. Search yanhuo on the canvas by double-clicking empty space, or browse the yanhuo category.
Common issues
"Something downstream still won't accept it." The output port is a wildcard, but the value still has to be the type the receiving node validates. Converting to int and wiring into a STRING socket works because the backend coerces; wiring into a node that checks for a specific custom type won't. This node is a scalar adapter, not a compatibility layer for models, latents or images.
"My boolean is always true." You fed it a string. Cast to boolean here and any non-empty text is truthy. Decide the truth upstream - a string comparison node, or an upstream value that's genuinely 0/1.
"It broke my working graph when a branch returned empty text." int("") raises. Guard the upstream or pick string and parse later.
"Do I need this at all?" For core nodes, probably not - the backend already converts. Reach for it when a strict custom pack is refusing your wire, when you need an int built from text (a shot number, a step count pulled from a filename), or when you're building a graph where an explicit type transition makes the intent readable to whoever loads your workflow next.
The plumbing layer this node belongs to - value nodes, wildcard types, optional inputs that arrive as nothing - is mapped in docs/knowledge/comfyui-node-plumbing.md. The cultural backlash against unbounded type-erasure is in docs/knowledge/comfyui-ecosystem.md.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| * | * | 接受任何类型的输入。 | |
| 格式类型 | COMBO | string | 选择要将输入转换成的目标类型。 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 输出 | * | — |