Basic data handling
Basic Python functions for manipulating data that every programmer is used to. Currently supported: BOOLEAN, FLOAT, INT, STRING and data lists.
Nodes (309)
Proceed only if both of these are true
The gate nobody needs, for when you need the gate
The strictest gate in the boolean family — true only when all is false
Flip any boolean, fix any backwards checkbox
Proceed if any of these are true
The difference detector disguised as a logic gate
Turn any old value into a clean true/false
Getting structured data into a DICT when the socket won't take it
The 'please be a decimal' node
Make it a whole number — but know it truncates, it doesn't round
Wrap anything into one Python list that travels as a single value
Dedupe anything in one step — order be damned
The node that lets you print, name, and debug anything
Is that prompt too long? compare length answers it, and hands you the real count
A dead-simple kill switch for a whole branch
One boolean for 'every item passed' — and an empty list is True
The 'at least one passed' check that keeps a batch alive
Add one item to the end of a data list, return a new list
The membership test that turns 'is it in the list?' into a boolean
How many of these made it through? Ask, don't eyeball.
Run a whole batch without duplicating a single node
Build a BOOLEAN list from toggles — feed a mask without touching Python
Build a FLOAT list from plain numbers — decimal values, batch-ready
Build an INT list from plain numbers — the dynamic-input list builder
Build a STRING list from text boxes — prompt batches without the regex gymnastics
Add numbers to a list — Python's enumerate, in graph form
Merge two data lists into one, the non-nesting way
Filter a list with a boolean mask — and yes, the polarity is inverted
Split a list into kept and dropped — both branches, no polarity traps
Grab the head of a data list — or None if it's empty
Pull any position out of a list — negative indices work too
Find where a value lives in a list — -1 when it's not there
Put an item at any position — not just the end
Last item in the list, minus the off-by-one panic
How big is that list? Ask instead of guessing
Build a list of lists, item by item
The biggest number in your list, without sorting for it
Find the floor of your list of numbers
Pop an item off a list and keep the leftover list too
Pull a random item out of a list, reproducibly
Generate a sequence of numbers, Python-style
Delete the first match of a value from your list
Flip a list end to end in one step
Swap one item in a list without rebuilding it
Randomize a list, and make the shuffle reproducible
Grab a chunk of a list, not the whole thing
Sort a list, ascending or descending, in one node
Total up a list of numbers, as both int and float
Convert a data list into a single LIST variable
Convert a list into a SET — say goodbye to duplicates
Zip parallel lists together, element by element
Diff two dictionaries and see exactly what changed
Does this dictionary have that key? Yes or no
Build config dicts without leaving the graph
Build a dict where you know the values are real booleans
Float values in a dict, guaranteed — for the config that does math
Integer values, locked in — build a dict that won't turn your counts into floats
Turn a pile of key-value pairs into a dict — the data list version
From a LIST of pairs to a dict — the pair-collector that round-trips
Zip two lists into a dict — keys from one, values from the other
All-string dicts, cleanly typed — when every value is text
Cut keys out of a dict without touching the original
Keep only the keys you name — a whitelist for your dict
Every key, one shared value — and the mutable-default trap to avoid
Pull a value out of a dict without crashing when the key's missing
Split a dict into its keys and values — two parallel lists out
Fetch several dict values in one shot — keys in, a values list out
Flip a dict — keys become values, values become keys
Unfold a dict into key-value pairs — the round-trip enabler
Just the key names, please — a dict's labels as a LIST
How many entries is that dict? — the count that feeds your logic
Merge up to four dicts, and the later one always wins
Pop one entry out — get the value AND the trimmed dict back
Need something out of a dict, and want to know what you got? pop item's the one
Grab a random key-value pair out of a dict — reproducible when you want it
Remove a key from a dict without ever seeing a KeyError
Add or update a key in a dict the way Python would — one node, one line
Give me the value, or put this default in for me — setdefault is both at once
Merge two dicts and know exactly who wins the tie
All the values out of a dict in one shot — no keys attached
Is this the same as that? The == node for any two values in your graph
Two nodes are racing and you're losing. Force a finish line.
Two floats in, one sum out — arithmetic without the mental gymnastics
The exact fraction hiding inside every float
Type a number as text, get a float out — the string-to-number escape hatch
Divide floats — and know that zero will kill it on purpose
The zero-safe division node
Read a hex float back to a number — the exact opposite of rounding
Turn a float into its exact hex form — lossless text, no rounding
3.0 is an integer, 3.5 isn't — the float reality check
Scaling values in your graph without a calculator trip
Powers, roots, and reciprocals in one node
Rounding in ComfyUI is way more annoying than it should be. This is the fix.
The minus sign you keep hunting for in your graph
The node that routes a value AND decides what runs next
Force ComfyUI to actually re-run its own graph
An AND gate that doesn't care what you feed it
OR with Python's truthiness, not just booleans
A plain > comparison node that accepts either number type
The comparison node for 'at least this much'
Real if/elif/else, without contorting your graph into a switch
Pick a path at runtime — and only compute the branch you actually take
Adding integers in ComfyUI without reaching for a math node
The node that counts 1-bits for no good reason until you need it
How many bits does this integer actually need?
Create INT parses number strings
Create INT with a base you choose
Divide that rounds down — and refuses to divide by zero
The 'infinity' trick
Turn raw bytes back into a number you can do math with
The remainder node — what's left after you divide
Multiply two integers and get back an integer, on purpose
2 to the 10th, without the math node
Subtraction, the boring node that keeps your math integer-typed
Pack an integer into raw bytes, byte order and all
A node that answers 'is this wire actually plugged in?'
'Why is this node silent?' — that's usually None hiding in your workflow
The < node for upper-bound checks
The <= node nobody searches for, and the whole workflow it unlocks
All — the list node that turns an AND gate into one input
Any — the OR gate you apply to a whole list at once
Append — build a list one item at a time without mutating anything
Contains — the membership test that ends 'is it in the list?' guesswork
Count — how many times does that value actually show up?
Create LIST — the starting line for every list in your workflow
Create LIST from BOOLEANs — a typed list that can't quietly drift
Create LIST from FLOATs — decimals in, decimals out, no cast drama
Create LIST from INTs — typed slots that catch your rounding mistakes
Create LIST from STRINGs — the list type that swallows everything
Enumerate — give every item a seat number
Extend — the append you meant when you had two lists
First — the head of the list, without the off-by-one ceremony
Get item — reach into a list and pull out exactly one thing
Index — find where something lives, or get a -1 that means 'nowhere'
Insert — put an item in the middle, not just at the end
Last — the tail of the list, when the end is what matters
Length — the node that tells you how big your list actually is
Max — the biggest value in the list, with a merciful failure mode
The smallest item in your LIST, without the crash
Pop items off a list like it's 1995
Grab a random item out of a list, reproducibly
Generate number sequences on the fly
Delete the first match — and know whether it worked
Flip a list around in one click
Replace the item at any position in a list
Shuffle a list with a seed you can trust
Cut a list down to just the slice you need
Sort your list — and don't trip over the silent failure
Add up a whole list in one go
The bridge from LIST to ComfyUI's native data list
Deduplicate a list by turning it into a SET
Strip the sign off any number
Given a ratio, get the angle
Given a ratio, get the angle
The angle whose tangent is your number
The quadrant-aware angle from x and y
Round up, every time, to the nearest whole number
Cosine of an angle — and the 90° gotcha
Radians to degrees in ComfyUI, minus the mental math
E, the constant node you'll forget exists until you need it
Your cheapest exponential curve builder
The int conversion that rounds the direction you expect
A math expression node that refuses to eval() you
Natural logarithms when your schedule is exponential under the hood
Base-10 logs for when you're thinking in magnitudes
The 'pick the bigger one' node that ends your clamp chains
The ceiling you clamp to when things get too big
The constant you don't need to memorize
Stop doing the math by hand
Smooth waves without leaving degrees behind
Square roots for when a value needs to be a root
The trig node that knows when it's undefined
The 'is this different' check for value switches
One node instead of a two-comparison tangle
Turning relative paths into ones you can trust
Stripping a path down to the filename
Finding what two paths share
The folder half of any path
Does that file actually exist? Stop guessing, wire it in
Paths with $HOME and %USERPROFILE% that work on any machine
What folder is ComfyUI actually running in?
Grab the .png off a filename — no regex required
File size in bytes, so your workflow can make decisions
Grab every *.png in a folder with one node
Stop hardcoding the ComfyUI input folder path
Absolute or relative? Ask the node instead of squinting
Is that path a folder? Ask instead of guessing
Is that path a file? The node that answers
Join path pieces the OS-safe way — no more missing slashes
List everything in a folder — files only, dirs only, or both
Load an image from any path — not just the input dropdown
Load an image and its alpha channel as a ready-to-use mask
Turn an RGBA file's alpha channel into a mask
A mask from a greyscale file — or the red channel, if you prefer
Read a prompt or config from a text file mid-workflow
Clean up messy paths without a regex in sight
Where did your image actually go? Stop guessing the output folder
Get a path relative to another folder — or to your cwd
Save your output to a path you choose, in the format you want
Save a cutout with its mask baked into the alpha channel
Get a string out of ComfyUI and into a real file
Swap a file extension without touching the rest of the path
Pull the folder and the filename apart
Strip the extension off a filename, properly
Regex findall, as a data list ComfyUI can actually fan out
Regex findall when you want the results as one LIST, not fanned out
Turn a prompt or filename into a labeled dictionary
Grab the capture groups from a match, as a data list
Capture groups as one LIST you can index later
Split a string on a regex, and fan the pieces out
Regex split into a single LIST, for when order is the data
Find-and-replace with a regex, the way your data actually needs
Does this string match? The boolean your branches have been missing
Add an item to a SET without mutating the original
Are all the values in this SET truthy? Python's all(), as a node
Did anything pass? Python's any(), as a node
Is this value in the set? Membership, answered with a boolean
Build a SET from scratch — the dedup engine for your workflow
Collect a pile of booleans into a SET — then ask it questions
Give ComfyUI a pile of floats and get back a set with the duplicates gone
Build a duplicate-free pool of integers without thinking about it
The string-set node you'll actually reach for
Everything in set A that isn't in set B — a one-wire subtraction
The set node that never throws a fit
Numbering a set — and why that's trickier than it sounds
Keep only what's in every set — intersection, up to four sets at once
Do these two sets have zero overlap? One boolean says it all
Is every element of A inside B? The containment check
Does A contain all of B? The flip side of the containment check
How many distinct items are in this set? Just count them
Grab any element out of a set — and get the rest back too
Pop a random element — reproducibly, if you want
Remove an item and get a straight answer about whether it was there
Add up a set — and get the answer twice, once as int, once as float
Everything in either, nothing in both
The bridge from Python sets to ComfyUI's per-item processing
The conversion that admits it lost your order
Merge sets and get the duplicates collapsed for free
First letter up, everything else down — Python's capitalize, exactly
The lowercase that makes 'ß' match 'ss'
Pad your text into neat columns
The if/else gate for text
The glue for building strings in ComfyUI
How many times does that substring show up?
Turn a data list back into one string
Turn b'...' back into readable text
Why your text suddenly looks like b'\\xc3\\xb6'
A cheap way to check what a string is
Make your text safe for JSON, logs, and code
The most niche tab you'll ever fix
Where does that substring actually live?
Prompt templates without string gymnastics
The simplest 'is it in there' test
Is this string letters and numbers only?
Letters only — no digits, no spaces
The gatekeeper for old-school text
The pickiest number check of them all
Digits, including the weird ones
Is this string a legal Python name?
Islower — the quiet case-checker for whatever text you just built
Isnumeric — the gate that keeps bad numbers out of your INT casts
Isprintable — the node that finds the invisible junk in your text
Isspace — the honest answer to 'is this prompt actually blank?'
Istitle — checking that every word behaves and capitalizes like it should
Isupper — the sibling of islower that checks the screaming text
Length — the string node you'll actually reach for, constantly
Join (from LIST) — turn a pile of strings into one string, with glue
Ljust — pad text on the right so your columns actually line up
Lower — normalize your text before it goes anywhere that cares
Lstrip — cut the junk off the front of your strings
Removeprefix — the polite way to delete the front of a string
Removesuffix — peel the extension off a filename without the guesswork
Replace — find-and-replace for your strings, with a count dial
Rfind — the 'last time this shows up' search your filenames need
Rjust — right-align your text so the numbers line up like a ledger
Rsplit (from data list) — split from the end, when the tail is what matters
Rsplit (from LIST) — split from the right, keeping the parts as one variable
Rstrip — the trailing-whitespace exterminator for text that came from files
Split (to data list) — one string in, a pile of parts out, each processed
One Prompt per Line, Rendered Separately
Splitlines as One LIST You Can Manipulate as a Unit
Split a CSV Prompt Into a LIST You Can Actually Index
A True/False Gate That Routes on What a String Begins With
Trim the Invisible Garbage Off Your Strings
The Case-Flipping Node You'll Use Once (and Enjoy)
Title-Case Your Prompts (and Watch Out for Apostrophes)
Make the Literal '\n' Actually Mean Something
Everything to Uppercase, No Surprises
Zero-Pad Numbers for Filenames That Sort Right
The pick-an-option node
Now Plus Three Days, the Way Math Should Work
A Duration You Can Add, Subtract, and Measure With
The 'How Long Between These Two Dates?' Node
Eight Time Components From One DATETIME, All at Once
Turn a DATETIME Into the Exact String Your Filename Needs
A Fresh Timestamp Every Run (Your Filenames Will Thank You)
Timestamps That Mean the Same Thing Everywhere
From '2026-08-16' to a Real DATETIME You Can Compute With
How Long Ago? Subtract a Duration From a Date
A DATETIME as Seconds-Since-Epoch — For Systems That Want It
Stop squinting at 1767225600 — turn Unix timestamps into real times
Tensor Binary Op — add, multiply, and otherwise math your tensors
Tensor Create — turning plain numbers into actual PyTorch tensors
Tensor Info — the node that tells you what the hell you're actually working with
Tensor Join — putting tensors together, two at a time
Tensor Permute — reordering dimensions without touching the data
Tensor Reshape — same data, different dimensions
Tensor Slice — cutting out the parts you actually want
Tensor Unary Op — one tensor in, one tensor out, a whole toolbox of math
Basic Data Handling
Basic Python functions for manipulating data that every programmer is used to. These nodes are very lightweight and require no additional dependencies.
Quickstart
Recommended Installation
- Install ComfyUI
- Install ComfyUI-Manager
- Look up the "Basic data handling" extension in ComfyUI-Manager
- Restart ComfyUI
Alternative (Manual Installation)
- Install ComfyUI
- Clone this repository under
ComfyUI/custom_nodes - Restart ComfyUI
Node Categories
BOOLEAN
Boolean logic operations:
- Logic operations: and, or, not, xor, nand, nor
Cast
Type conversion nodes for ComfyUI data types: to BOOLEAN, to FLOAT, to INT, to STRING, to DICT, to LIST, to SET
Comparison
Value comparison nodes:
- Basic comparisons: equal (==), not equal (!=), greater than (>), greater than or equal (>=), less than (<), less than or equal (<=)
- String comparison: StringComparison with case-sensitive/insensitive options
- Special comparisons: NumberInRange, IsNull
- Container operations: CompareLength
Control Flow
Mechanisms to direct workflow execution:
- Conditional branching:
- if/else - Routes based on a boolean condition
- if/elif/.../else - Supports multiple conditional branches
- switch/case - Selects from options based on an index
- Execution management:
- disable flow - Conditionally enables/disables a flow
- flow select - Directs output to either "true" or "false" path
- force calculation - Prevents caching and forces recalculation
- force execution order - Controls node execution sequence
Data List
ComfyUI list manipulation nodes (for processing individual items):
- Creation: create Data List (generic and type-specific versions)
- Modification: append, extend, insert, set item, shuffle, remove, pop, pop random
- Filtering: filter, filter select
- Access: get item, first, last, slice, index, contains
- Information: length, count
- Operations: sort, reverse, zip, min, max
- Conversion: convert to LIST, convert to SET
DICT
Dictionary manipulation nodes:
- Creation: create (generic and type-specific), create from items, create from lists, fromkeys
- Access: get, get_multiple, keys, values, items
- Modification: set, update, setdefault, merge
- Removal: pop, popitem, pop random, remove
- Information: length, contains_key
- Operations: filter_by_keys, exclude_keys, invert, compare
- Conversion: get_keys_values
FLOAT
Floating-point operation nodes:
- Creation: create FLOAT from string
- Basic arithmetic: add, subtract, multiply, divide, divide (zero safe), power
- Formatting: round (to specified decimal places)
- Conversion: to_hex, from_hex
- Analysis: is_integer, as_integer_ratio
INT
Integer operation nodes:
- Creation: create INT, create INT with base
- Basic arithmetic: add, subtract, multiply, divide, divide (zero safe), modulus, power
- Bit operations: bit_length, bit_count
- Byte conversion: to_bytes, from_bytes
LIST
Python list manipulation nodes (as a single variable):
- Creation: create LIST (generic and type-specific versions)
- Modification: append, extend, insert, remove, pop, pop random, set_item, shuffle
- Access: get_item, first, last, slice, index, contains
- Information: length, count
- Operations: sort, reverse, min, max
- Conversion: convert to data list, convert to SET
Math
Mathematical operations:
- Generic: formula
- Trigonometric functions: sin, cos, tan, asin, acos, atan, atan2
- Logarithmic/Exponential: log, log10, exp, sqrt
- Constants: pi, e
- Angle conversion: degrees, radians
- Rounding operations: floor, ceil
- Min/Max functions: min, max
- Other: abs
Path
File system path manipulation nodes:
- Basic operations: join, split, splitext, basename, dirname, normalize
- Path information: abspath, exists, is_file, is_dir, is_absolute, get_size, get_extension, set_extension, input_dir, output_dir
- Directory operations: list_dir, get_cwd
- Path searching: glob, common_prefix
- Path conversions: relative, expand_vars
- File loading: load STRING from file, load IMAGE from file, load IMAGE+MASK from file, load MASK from alpha channel, load MASK from greyscale/red
- File saving: save STRING to file, save IMAGE to file, save IMAGE+MASK to file
SET
Python set manipulation nodes (as a single variable):
- Creation: create SET (generic and type-specific versions)
- Modification: add, remove, discard, pop, pop random
- Information: length, contains
- Set operations: union, intersection, difference, symmetric_difference
- Set comparison: is_subset, is_superset, is_disjoint
- Conversion: convert to data list, convert to LIST
STRING
String manipulation nodes:
- Text case conversion: capitalize, casefold, lower, swapcase, title, upper
- Text inspection: contains, endswith, find, length, rfind, startswith
- Character type checking: isalnum, isalpha, isascii, isdecimal, isdigit, isidentifier, islower, isnumeric, isprintable, isspace, istitle, isupper
- Text formatting: center, expandtabs, ljust, rjust, zfill
- Text splitting/joining: join, split, rsplit, splitlines (with data list and LIST variants)
- Text modification: concat, count, replace, strip, lstrip, rstrip, removeprefix, removesuffix
- Encoding/escaping: decode, encode, escape, unescape, format_map
TENSOR
PyTorch tensor manipulation nodes:
- Creation: Tensor Create (from numbers, lists, or other tensors)
- Arithmetic: Tensor Binary Op (add, subtract, multiply, divide, power, remainder, floor_divide)
- Functions: Tensor Unary Op (abs, neg, exp, log, sin, cos, sqrt, sigmoid, relu)
- Reshaping: Tensor Reshape, Tensor Permute (dims)
- Access: Tensor Slice (supports Python-style slice strings like
0:10, :, 5) - Combined: Tensor Join (concatenate or stack)
- Analysis: Tensor Info (returns shape, dtype, device)
Time
Date and time manipulation nodes:
- DateTime creation/conversion: TimeNow, TimeNowUTC, TimeToUnix, UnixToTime
- String formatting/parsing: TimeFormat, TimeParse
- Time calculations: TimeDelta, TimeAddDelta, TimeSubtractDelta, TimeDifference
- Component extraction: TimeExtract (year, month, day, hour, etc.)
Understanding Data Types
ComfyUI provides three different collection types that serve distinct purposes:
Collection Types and When to Choose Them
| Type | Description | When to Choose | |---------------|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | data list | Native ComfyUI list where items are processed individually | • When you need ComfyUI to process each item individually<br>• For batch operations with parallel processing<br>• When connecting to nodes that expect individual inputs | | LIST | Python list passed as a single variable | • When you need ordered collections with preserved duplicates<br>• When index-based access is important<br>• When you need to work with the collection as a complete unit | | SET | Python set passed as a single variable | • When you need to ensure unique values only<br>• When you need fast membership testing<br>• For set operations (union, intersection, etc.)<br>• When element order doesn't matter |