BOOL Logic Expression Utility

Boolean Expression Evaluator

Evaluate Boolean logic expressions with assigned true or false variable values. Use AND, OR, NOT, XOR, XNOR, NAND, NOR, parentheses and Boolean constants, then inspect the parsed expression and step-by-step evaluation.

✓ AND / OR / NOT ✓ XOR / XNOR ✓ NAND / NOR ✓ Parentheses ✓ TRUE / FALSE ✓ Evaluation Steps
A→?
Boolean Expression Evaluation
● Ready
Use single-letter variables A–Z, constants TRUE/FALSE or 1/0, and operators AND, OR, NOT, XOR, XNOR, NAND and NOR.
Variable Values
Variables are detected automatically from the expression.
Precedence: NOT is evaluated first, followed by AND/NAND, XOR/XNOR, and finally OR/NOR. Parentheses override normal precedence. This evaluator uses a dedicated Boolean parser rather than JavaScript eval().
Boolean Evaluation Result Valid Expression
Final Boolean Result
Variables
Operators
TRUE Variables
FALSE Variables
Tokens
Evaluation Steps
Root Result
Status
Variable Assignments
Step-by-Step Evaluation
Parser Details

Boolean Expression Evaluator

The Boolean Expression Evaluator calculates the true or false result of a logical expression after you assign Boolean values to its variables. It supports common operators including AND, OR, NOT, XOR, XNOR, NAND and NOR together with nested parentheses.

Unlike a truth table generator, which evaluates every possible variable combination, this tool evaluates one specific set of variable values at a time. For example, you can set A to true, B to false and C to true and immediately determine the result of a larger expression.

The evaluator also shows the detected variables, parser output and individual logic operations so you can verify how the final answer was obtained.

How to Evaluate a Boolean Expression

Enter an expression such as (A OR B) AND NOT C. The evaluator detects the variables automatically and displays True and False selectors for each one.

Choose the value of every variable and press Evaluate Boolean Expression. The final result and evaluation steps appear below.

Expression: (A OR B) AND NOT C Assignments: A = TRUE B = FALSE C = FALSE Evaluation: A OR B = TRUE OR FALSE = TRUE NOT C = NOT FALSE = TRUE TRUE AND TRUE = TRUE Final result: TRUE

What Is a Boolean Expression?

A Boolean expression is a logical statement whose final value is either true or false. Expressions can contain Boolean variables, constants, operators and parentheses.

A AND B NOT A A XOR B (A OR B) AND C A AND (B OR NOT C) (A NAND B) XOR C

Boolean expressions are widely used in programming conditions, digital logic, search filters, permissions, electronic circuits and formal logic.

Boolean AND Evaluation

AND returns true only when both operands are true.

A B A AND B
FALSEFALSEFALSE
FALSETRUEFALSE
TRUEFALSEFALSE
TRUETRUETRUE

Boolean OR Evaluation

OR returns true when at least one operand is true.

TRUE OR TRUE = TRUE TRUE OR FALSE = TRUE FALSE OR TRUE = TRUE FALSE OR FALSE = FALSE

Boolean NOT Evaluation

NOT is a unary operator. It reverses the Boolean state of the expression immediately following it.

NOT TRUE = FALSE NOT FALSE = TRUE NOT (A AND B) = complement of the entire parenthesized result

Boolean XOR Evaluation

XOR, or exclusive OR, returns true when two operands have different Boolean values.

FALSE XOR FALSE = FALSE FALSE XOR TRUE = TRUE TRUE XOR FALSE = TRUE TRUE XOR TRUE = FALSE

Boolean XNOR Evaluation

XNOR is the complement of XOR. It returns true when both operands have the same Boolean value.

FALSE XNOR FALSE = TRUE FALSE XNOR TRUE = FALSE TRUE XNOR FALSE = FALSE TRUE XNOR TRUE = TRUE

For this reason, XNOR is often described as a Boolean equivalence operation.

Boolean NAND Evaluation

NAND means NOT AND. It produces false only when both operands are true.

A NAND B = NOT (A AND B) TRUE NAND TRUE = FALSE TRUE NAND FALSE = TRUE

Boolean NOR Evaluation

NOR means NOT OR. It evaluates to true only when both operands are false.

A NOR B = NOT (A OR B) FALSE NOR FALSE = TRUE TRUE NOR FALSE = FALSE

Using TRUE, FALSE, 1 and 0

The evaluator supports Boolean constants in addition to variables. TRUE and 1 are treated as true values, while FALSE and 0 represent false.

A AND TRUE FALSE OR B NOT 0 1 XOR A A NAND TRUE

Constants do not create variable controls because their values are already defined by the expression itself.

Boolean Expression Operator Precedence

When parentheses do not explicitly define the order of evaluation, the calculator uses a consistent Boolean precedence system.

Priority Operators Meaning
1 – Highest NOT Unary complement
2 AND, NAND AND-family operations
3 XOR, XNOR Exclusive comparison
4 – Lowest OR, NOR OR-family operations

Why Parentheses Matter

Parentheses explicitly define which expression should be evaluated first and are recommended whenever a Boolean expression contains several operators.

A OR B AND C is evaluated as: A OR (B AND C) But: (A OR B) AND C evaluates the OR expression first.

These two expressions can produce different results for the same variable assignments.

Nested Boolean Expressions

Parentheses can be nested to represent multiple levels of logical decision making.

Expression: (A AND (B OR C)) XOR (NOT D) Example assignments: A = TRUE B = FALSE C = TRUE D = FALSE B OR C = TRUE A AND TRUE = TRUE NOT D = TRUE TRUE XOR TRUE = FALSE

Boolean Expression Evaluation Example

Consider the expression A AND (B OR NOT C).

A = TRUE B = FALSE C = FALSE Step 1: NOT C = TRUE Step 2: B OR TRUE = TRUE Step 3: A AND TRUE = TRUE Result: TRUE

Boolean Expression Evaluator vs Truth Table Generator

Both tools work with Boolean expressions, but they answer different questions.

Tool Purpose Variable Values Output
Boolean Expression Evaluator Evaluate one specific case User assigns each value One final Boolean result
Truth Table Generator Test every possible case Automatically generates all combinations Complete truth table

Use this evaluator when you already know the values of the variables and need to determine whether the expression is true or false.

Boolean Expressions in Programming

Programming languages use Boolean expressions to control decisions, loops, validation, permissions and application state.

Conceptual condition: LoggedIn AND (Admin OR Editor) Example: LoggedIn = TRUE Admin = FALSE Editor = TRUE Result: TRUE

The syntax used by actual programming languages varies, but the underlying Boolean logic follows the same truth rules.

Boolean Expressions in Digital Logic

Digital circuits can also be described with Boolean expressions. Variables represent logic-level inputs while operators correspond to logic gates.

Expression: (A AND B) OR C Possible gate structure: A ──┐ AND ──┐ B ──┘ OR ── Output C ────────┘

Evaluating the expression for a chosen set of input states predicts the output of the corresponding combinational circuit.

Boolean Expressions for Permissions and Rules

Logical expressions are frequently used to represent access-control rules and feature conditions.

Expression: Premium AND NOT Suspended Premium = TRUE Suspended = FALSE Result: TRUE

More complex policies can combine multiple conditions with nested AND, OR and NOT expressions.

Common Boolean Expression Errors

A common error is writing two variables next to one another without an operator, such as A B. The evaluator requires an explicit operator such as A AND B.

Another error is leaving an operator without a right-hand operand, such as A OR. Parentheses must also be balanced, so expressions such as (A AND B without a closing parenthesis are rejected.

NOT is unary and must appear before a variable, constant or parenthesized expression. For example, NOT A and NOT (A OR B) are valid.

Why This Evaluator Does Not Use eval()

The tool uses a dedicated tokenizer, operator-precedence parser and stack-based Boolean evaluator. Only the supported variables, constants, parentheses and Boolean operators are accepted.

This keeps expression interpretation limited to Boolean logic instead of executing arbitrary JavaScript code supplied in the input field.

Boolean Expression Evaluator Limitations and Notes

Variables are represented by individual letters A through Z. Operator names are case-insensitive, so A and B and A AND B are interpreted equivalently.

The evaluator is intended for Boolean logic rather than arithmetic comparison. Expressions such as A > 5, X == Y or numeric addition are outside the scope of this tool.

Each detected variable must be assigned either true or false. Constants TRUE, FALSE, 1 and 0 require no assignment.

Boolean Expression Evaluator FAQs

What does a Boolean Expression Evaluator do?
It calculates whether a Boolean expression is true or false for a specific set of assigned variable values.
Which Boolean operators are supported?
The evaluator supports AND, OR, NOT, XOR, XNOR, NAND and NOR.
Can I use parentheses?
Yes. Parentheses can be nested and override the default operator precedence.
Can I use TRUE and FALSE directly?
Yes. TRUE and FALSE are supported Boolean constants.
Can I use 1 and 0 as Boolean constants?
Yes. 1 represents true and 0 represents false.
What is TRUE AND FALSE?
TRUE AND FALSE evaluates to FALSE.
What is TRUE OR FALSE?
TRUE OR FALSE evaluates to TRUE.
What is NOT TRUE?
NOT TRUE evaluates to FALSE.
What is TRUE XOR FALSE?
TRUE XOR FALSE evaluates to TRUE because the two values differ.
What is TRUE XNOR TRUE?
TRUE XNOR TRUE evaluates to TRUE because both operands are equal.
What is TRUE NAND TRUE?
TRUE NAND TRUE evaluates to FALSE.
What is FALSE NOR FALSE?
FALSE NOR FALSE evaluates to TRUE.
Which Boolean operator is evaluated first?
NOT has the highest priority, followed by AND/NAND, XOR/XNOR, and then OR/NOR. Parentheses override this order.
How is this different from a truth table generator?
An evaluator calculates one chosen set of variable assignments. A truth table generator calculates every possible assignment combination.
Does this tool execute JavaScript code?
No. The expression is interpreted with a dedicated Boolean parser and not with JavaScript eval().
Scroll to Top