ECParts Toolkit LogoECParts Toolkit

Boolean Logic Calculator

Enter Boolean expressions with variables A, B, C, and D, then evaluate custom input states, generate truth tables, compare logical equivalence, or validate expression syntax.

DIG-002 works at the Boolean behavior level. It does not simulate analog thresholds, gate delay, power, FPGA synthesis, HDL output, or physical circuit optimization.

Engineering tool

Boolean Logic Calculator

Evaluate Boolean expressions, generate truth tables, compare expression equivalence, and inspect parsed expression structure.

Calculator mode

Supported variables: A, B, C, D. Operators: AND &, OR | or +, NOT ! or ~, XOR ^.

Custom input combination

A
B
C

Result console

Expression Result
1
Validation Status
Valid
Variables
A, B, C
Truth Table Rows
8rows
Parsed Expression
(A · B) + C

Expression structure

Parsed Expression
(A · B) + C
Simplified Representation
(A · B) + C
AST Summary
Binary(OR, Binary(AND, Variable(A), Variable(B)), Variable(C))

Formula reference

Boolean Expression Rules

The calculator parses Boolean expressions into an AST and evaluates logical behavior with deterministic operator precedence.

NOT: ¬AAND: A · BXOR: A ⊕ BOR: A + BPrecedence: NOT > AND > XOR > ORTruth table rows = 2^n

Variable definitions

A, B, C, D
supported Boolean variables
0
false or LOW logic state
1
true or HIGH logic state
AST
abstract syntax tree
n
number of unique variables in the expression
Equivalent expressions
same output for every input combination

Worked Examples

A & B

AND evaluates to 1 only when A=1 and B=1.

A | B

OR evaluates to 1 when either input is 1.

!A

NOT inverts A, so A=0 produces 1 and A=1 produces 0.

A ^ B

XOR evaluates to 1 when A and B are different.

(A & B) | C

Parentheses group A AND B before the OR operation with C.

!(A | B)

The OR result is inverted, producing NOR behavior.

A ^ B vs (A & !B) | (!A & B)

These two expressions are equivalent forms of XOR.

(A ^ B) & (!C)

A three-variable expression that combines XOR with an inverted enable term.

A && B

This is invalid because the parser accepts a single & operator for AND.

A & B & C

A three-variable expression generates 8 truth-table rows.

Engineering Notes

  • Boolean expressions describe logical behavior in digital systems, not analog voltage thresholds.
  • The parser uses tokens, an abstract syntax tree, and a deterministic evaluator.
  • Operator precedence matters. NOT binds before AND, XOR, and OR.
  • Truth tables grow as 2^n, so this calculator intentionally limits expressions to A, B, C, and D.
  • Equivalent Boolean expressions can behave identically while still producing different physical gate networks.
  • Real hardware implementation can add propagation delay, fanout limits, loading, and power consumption.
  • Use explicit parentheses when transferring formulas into code, HDL, schematics, or documentation.
  • XOR is not the same as OR; two-input XOR is LOW when both inputs are HIGH.

Common Mistakes

  • Ignoring operator precedence.
  • Forgetting that NOT has the highest precedence.
  • Confusing XOR with OR.
  • Using parentheses incorrectly.
  • Assuming Boolean equivalence guarantees identical hardware timing.
  • Using unsupported symbols such as double operators.
  • Typing variables outside the supported A, B, C, D range.
  • Expecting this calculator to generate HDL or optimize circuits.

Support reference

FAQ

What is a Boolean expression?

A Boolean expression combines true and false variables with logical operators such as AND, OR, NOT, and XOR.

How does a Boolean calculator work?

This calculator tokenizes the expression, parses it into an abstract syntax tree, evaluates the AST for selected input values, and can generate every truth-table row.

What is Boolean algebra?

Boolean algebra is the mathematical system used to describe logic operations in digital circuits, switching systems, and binary decision logic.

What is the precedence of Boolean operators?

This calculator uses NOT as the highest precedence, followed by AND, then XOR, and finally OR.

How do I simplify Boolean expressions?

This v1 calculator shows a normalized representation and basic identity simplifications. Karnaugh map minimization is planned for a dedicated calculator.

What is XOR?

XOR means exclusive OR. For two inputs, XOR outputs true when the inputs are different.

How are truth tables generated?

The calculator identifies the variables used in the expression and evaluates the expression for every 2^n input combination.

Can this calculator optimize circuits?

No. It evaluates Boolean behavior and compares equivalence only. It does not optimize gate count, timing, power, or FPGA implementation.

What is an AST?

An abstract syntax tree is a structured representation of the parsed expression, showing variables, unary operations, and binary operations.

Why should eval not be used for expressions?

Dynamic execution is unsafe and unnecessary. A dedicated parser can validate the expression and evaluate Boolean logic without executing user input as code.

Logic Gate Truth Table Calculator

Available

Generate truth tables and compare standard AND, OR, NOT, NAND, NOR, XOR, and XNOR gates.

Open calculator

Karnaugh Map Simplifier

Coming_Soon

Planned calculator for minterms, don't-care terms, K-map grids, and simplified SOP output.

Binary Arithmetic Calculator

Coming_Soon

Planned calculator for binary addition, subtraction, overflow, and signed arithmetic.

Binary Bitwise Calculator

Coming_Soon

Planned calculator for AND, OR, XOR, NOT, shifts, masks, and bit operations.

Planned Guide

Boolean Algebra Basics

Planned Guide

Boolean Expression Simplification

Planned Guide

Truth Tables Explained

Planned Guide

Logic Equivalence in Digital Design

Planned Guide

AND OR XOR Logic