Extensions/ComfyUI-BooleanExpression
ComfyUI Extension

ComfyUI-BooleanExpression

A collection of logic and comparison nodes for ComfyUI. This package adds building blocks for boolean logic, arithmetic comparisons, and string comparisons, making it easier to design conditional workflows directly in ComfyUI.

By marco-zanella·Created about a year ago·Updated about a year ago· 0
marco-zanella/ComfyUI-BooleanExpression
Nodes30
On cloudLocal install
CategoryBoolean Expressions, Boolean Expressions/Arithmetic Comparisons
Stars0
Updatedabout a year ago

Nodes (30)

And

Both conditions? Then And is your node

Boolean Expressions
Binary Comparison

Binary Comparison

Boolean Expressions/Arithmetic Comparisons
Equal to

Equal to, and the floating-point trap hiding in it

Boolean Expressions/Arithmetic Comparisons
Greater than

Let Greater than make the call

Boolean Expressions/Arithmetic Comparisons
Greater than or equal to

Greater than or equal to

Boolean Expressions/Arithmetic Comparisons
Less than

The quiet workhorse of aspect-ratio checks

Boolean Expressions/Arithmetic Comparisons
Less than or equal to

Less than or equal to (and why that space is in its name)

Boolean Expressions/Arithmetic Comparisons
Not equal to

The simplest way to say 'everything but'

Boolean Expressions/Arithmetic Comparisons
Binary Expression

Binary Expression

Boolean Expressions
Conditional Branch

ComfyUI's if/then, minus the surprises (mostly)

Boolean Expressions
False

A tiny False node, and why constants earn their keep

Boolean Expressions
Nand

The boolean gate everyone forgets (until they need it)

Boolean Expressions
Nor

The 'neither of these' gate

Boolean Expressions
Not

The one-word inverter that fixes half your logic bugs

Boolean Expressions
Or

The 'any of these' gate

Boolean Expressions
Equal to

Equal strings, without the case drama

Boolean Expressions/String Comparisons
Comes after

Ordering strings so a workflow can sort

Boolean Expressions/String Comparisons
Comes after or equal to

The inclusive end of the string sort

Boolean Expressions/String Comparisons
Comes before

String ordering without a dictionary

Boolean Expressions/String Comparisons
Comes before or equal to

The boundary, included

Boolean Expressions/String Comparisons
Not equal to

\"Not equal to\" in ComfyUI without writing a line of Python

Boolean Expressions/String Comparisons
Contains

Turn a keyword into a workflow fork

Boolean Expressions/String Comparisons
Ends with

The ComfyUI node that sniffs file extensions

Boolean Expressions/String Comparisons
Does not contain

Gating workflows on what is NOT there

Boolean Expressions/String Comparisons
Does not end with

Skip the pass you don't need

Boolean Expressions/String Comparisons
Does not Start with

Filter out the noise before it reaches the graph

Boolean Expressions/String Comparisons
Starts with

Routing workflows by model family, one prefix at a time

Boolean Expressions/String Comparisons
String Comparison

The one string node to rule them all

Boolean Expressions/String Comparisons
True

The ComfyUI node that outputs... true. It's more useful than it looks.

Boolean Expressions
Xor

The boolean node for 'exactly one, never both'

Boolean Expressions
Readme

ComfyUI Boolean Expressions

License: GPL v3 ComfyUI CI Publish to Comfy registry

A collection of logic and comparison nodes for ComfyUI.
This package adds building blocks for boolean logic, arithmetic comparisons, and string comparisons, making it easier to design conditional workflows directly in ComfyUI.

✨ Features

  • Boolean logic (And, Or, Not, etc.)
  • Arithmetic comparisons (<, >, =, …)
  • String comparisons (contains, starts with, ends with, …)
  • Conditional Branch (if–then–else logic flow)
  • Organized under Boolean Expressions category
  • Works with booleans, numbers, and strings

Use these nodes to:

  • Switch between inputs based on conditions.
  • Build parameterized prompts.
  • Compare numbers or strings dynamically.
  • Create reusable logical subgraphs.

📦 Installation

With ComfyUI Manager

  1. Open ComfyUI Manager in your ComfyUI installation.
  2. Search for ComfyUI-BooleanExpression.
  3. Click Install.

Manual install

Clone this repository into your custom_nodes folder:

cd ComfyUI/custom_nodes
git clone https://github.com/marco-zanella/ComfyUI-BooleanExpression.git

Restart ComfyUI, and the nodes will appear under the Boolean Expressions category.

📸 Examples

Conditional Latent Image

This workflow demonstrates how a boolean toggle can control whether generation begins from an empty latent image or from a selected input image converted into latent space. Two Conditional Branch nodes manage the logic: the first selects which latent image to use, while the second determines the correct denoise factor, applying a user-defined value when starting from an existing image and defaulting to 1.0 when starting from an empty latent.

Example Workflow Download this workflow

Conditional Format Prompt

This workflow demonstrates how to automatically select prompts optimized for square, portrait, or landscape images based on the configured width and height. Arithmetic comparison nodes (Equal to and Less than) determine the image’s aspect ratio, and two Conditional Branch nodes then return the appropriate prompt.

Example Workflow Download this workflow

🔧 Detailed Node List

Boolean Logic

  • False
  • True
  • Not
  • And
  • Or
  • Xor
  • Nand
  • Nor
  • Binary Expression
  • Conditional Branch (if–then–else)

Arithmetic Comparison

  • Less than
  • Less than or equal to
  • Equal to
  • Not equal to
  • Greater than or equal to
  • Greater than
  • Binary Comparison

String Comparison

  • Comes before (alphabetical less than)
  • Comes before or equal to
  • Equal to
  • Not equal to
  • Comes after or equal to
  • Comes after
  • Contains
  • Does not contain
  • Starts with
  • Does not start with
  • Ends with
  • Does not end with
  • String Comparison