Convert String To Float [LP]
Parsing text into a real numeric value
- FLOAT
The mirror image of StringToCombo-LP and IntToString-LP - where those turn numbers or text into something else, this one parses a plain string as a decimal number and hands you back a proper FLOAT that ComfyUI's numeric sockets will actually accept.
Why you'd need this
Values coming out of text nodes are just text, even when they look like numbers to you. Maybe you've got a value baked into a prompt template, parsed out of a filename, extracted from a tag string, or typed into a plain text field because that's the only input a particular upstream node exposes. If you then need that value to drive something numeric - a CFG scale, a denoise strength, a LoRA weight - ComfyUI won't let a STRING output plug directly into a FLOAT input. This node bridges that gap the same way IntToString-LP bridges it in the other direction.
How it works
It's a straight parse - Python's float() on whatever string you give it, nothing fancier. That means it handles a normal decimal like "7.5" fine, but it isn't forgiving about format. There's no fallback value and no error handling built in: if the string isn't a valid float literal, the node throws and the whole queued run fails at that point rather than silently defaulting to zero.
The inputs and outputs that matter
- string - the only input, a plain text field, defaulting to empty.
- Output - a single FLOAT, ready to wire into any numeric widget or input.
That's it - one input, one output, no options to configure.
How to install it
ComfyUI Manager: search "ComfyUI Level Pixel" or the repo name ComfyUI-LevelPixel, install, restart - updates automatically through Manager's "Update ALL." Manual installation:
cd ComfyUI/custom_nodes
git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git
Restart ComfyUI. Pure Python conversion logic, nothing else to install.
Common issues & troubleshooting
The node errors with something like "could not convert string to float." Almost always a formatting mismatch. float() wants a period as the decimal separator - a value typed European-style with a comma, like "7,5", will fail. Strip out anything that isn't a digit, a period, or a leading minus sign before it reaches this node.
You left the field blank and queued the run. The default is an empty string, and float("") is not a valid conversion - it throws immediately rather than quietly resolving to 0.0. Type an actual number before queuing, or make sure whatever upstream text source feeds this node is guaranteed to produce something parseable.
Units or extra characters snuck into the string. Something like "7.5x" or "7.5 steps" will also fail to parse - this node expects a bare number, no suffix, no units, no thousands separators. If your source data includes units or labels, strip them with a text-processing node first.
You're not sure the upstream value will always be numeric. If the source is unreliable or sometimes produces non-numeric text, this strict node isn't the right fit - you'd need to sanitize the string first, since there's no graceful fallback built into StringToFloat-LP itself.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |