ComfyUI > Nodes > ComfyUI > Number Convert

ComfyUI Node: Number Convert

Class Name

ComfyNumberConvert

Category
utils
Author
ComfyAnonymous (Account age: 763days)
Extension
ComfyUI
Latest Updated
2026-05-13
Github Stars
112.77K

How to Install ComfyUI

Install this extension via the ComfyUI Manager by searching for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Number Convert Description

Facilitates seamless conversion between data types into numeric formats, simplifying workflows and ensuring data integrity.

Number Convert:

The ComfyNumberConvert node is designed to facilitate seamless conversion between various data types into numeric formats, specifically FLOAT and INT. This node is particularly useful when you need to handle different input types such as integers, floats, strings, and booleans, and convert them into a unified numeric format for further processing or analysis. By providing a single node that manages these conversions, it simplifies workflows and reduces the need for multiple conversion nodes, enhancing efficiency and clarity in your projects. The node ensures that inputs are accurately converted, handling edge cases like empty strings or non-finite numbers with appropriate error messages, thus maintaining data integrity and reliability.

Number Convert Input Parameters:

value

The value parameter is the input that you wish to convert into numeric formats. It accepts multiple types, including integers, floats, strings, and booleans. This flexibility allows you to input data in its original form without needing to pre-process it into a specific type. The node will then handle the conversion internally. There are no explicit minimum, maximum, or default values for this parameter, as it is designed to accept a wide range of inputs. However, it is important to ensure that the input is a valid representation of a number when using strings, as invalid strings will result in conversion errors.

Number Convert Output Parameters:

FLOAT

The FLOAT output parameter provides the converted floating-point representation of the input value. This output is crucial for scenarios where precision is important, such as in calculations involving decimal numbers. The conversion process ensures that the input is accurately represented as a float, even if it originally was an integer or a boolean.

INT

The INT output parameter delivers the integer representation of the input value. This output is particularly useful when you need whole numbers for indexing, counting, or other operations that require integer values. The conversion process truncates any decimal portion of a float input, aligning with typical integer conversion practices.

Number Convert Usage Tips:

  • When working with string inputs, ensure that the string is a valid numeric representation to avoid conversion errors. For example, "123" or "45.67" are valid, while "abc" is not.
  • Use this node to streamline workflows that require multiple type conversions, reducing the complexity of your node setup and improving readability.

Number Convert Common Errors and Solutions:

Cannot convert empty string to number.

  • Explanation: This error occurs when an empty string is provided as input, which cannot be converted into a numeric format.
  • Solution: Ensure that the string input is not empty and contains a valid numeric representation before passing it to the node.

Cannot convert string to number: <value>

  • Explanation: This error indicates that the provided string cannot be interpreted as a number, possibly due to non-numeric characters.
  • Solution: Verify that the string input is a valid number. Remove any non-numeric characters or spaces that might be causing the issue.

Cannot convert non-finite value to number: <float_val>

  • Explanation: This error arises when the conversion results in a non-finite number, such as infinity or NaN, which cannot be processed as a valid numeric output.
  • Solution: Check the input value to ensure it does not lead to non-finite results. Adjust the input to avoid operations that result in infinity or NaN.

Number Convert Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Number Convert