Nodes/Basic data handling/create INT with base
ComfyUI Node

create INT with base

Create INT with a base you choose

By StableLlama·Created about a year ago·Updated 4 days ago· 48
create INT with base
    • INT
    value0
    base10

    The difference between this node and the pack's plain create INT is one number: the base. create INT reads the prefix and guesses; create INT with base lets you say explicitly "treat this string as base 16," or base 8, or base 2, or base 36. It's the node for parsing hex values that arrive without the 0x prefix - the case the auto-detect node can't handle.

    What it does

    You give it a string and a base, and it runs Python's int(value, base). With base 16, "ff" becomes 255. With base 8, "17" becomes 15. With base 2, "1010" becomes 10. The base input has a minimum of 2, and Python's int parsing accepts any base from 2 through 36, so you can even do base-36 decoding of short alphanumeric codes if you're into that.

    Where this earns its keep: files and formats that give you raw hex without the prefix. MAC addresses, color hex codes that strip the #, binary dumps, checksums - these arrive as bare "ff" or "deadbeef" strings, and this is the only node in the pack that can turn them into numbers without you manually prepending 0x.

    Inputs and outputs

    • value - STRING, default "0". The number to parse, in the given base.
    • base - INT, default 10, minimum 2. Which base to interpret the string in.
    • Output INT - the parsed integer.

    If the string contains a digit invalid for the base - like "9" in base 2 - the node errors. That's correct behavior: garbage in, loud error, not silent nonsense.

    Install

    Ships in the Basic data handling pack. ComfyUI Manager → search "Basic data handling" → install → restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
    

    then restart ComfyUI. Zero dependencies, no model downloads.

    The rule of thumb

    Prefixed string (0x1F, 0b1010)? Use create INT, let it auto-detect. Bare string ("ff", "1010", octal from an old config)? Use this node and set the base explicitly. That's the entire decision tree, and it's the kind of pairing you'll remember the moment a config file hands you a bare hex value and every math node in your graph refuses to touch it.

    CategoryBasic/INT

    Inputs (2)

    NameTypeDefaultDescription
    valueSTRING0
    baseINT10

    Outputs (1)

    NameTypeDescription
    INTINT