Skip to content
BetterDL

Boolean operator

Also called: Boolean operators, logical operator, logical operators, logic operator, logic operators

An operation that combines Boolean values to give a 0 or 1 result. The three basic ones are AND, OR and NOT.

A Boolean operator takes one or more 0/1 values and produces a 0/1 result. The three basic operators are:

  • AND (AB): 1 only when all inputs are 1.
  • OR (A + B): 1 when at least one input is 1.
  • NOT, the complement (): flips 0 and 1.

These three are enough to describe any boolean function: list the rows where the output is 1, write an AND term for each, and OR them together. That is why they are the core of Boolean algebra.

Other common operators are built from them. NAND is , NOR is , XOR is and XNOR is . Each has its own gate; see logic gate.

When operators are mixed, operator precedence decides the order: NOT, then AND, then OR.

Notation differs between fields: ∧, ∨ and ¬ in discrete maths, &&, || and ! in code. The logic is identical.

00000
01011
10011
11110

Worked example

Example

Building XOR from the three basics

Write "A or B, but not both" with AND, OR and NOT only.

  1. 1.

    "A but not B" is .

  2. 2.

    "B but not A" is .

  3. 3.

    Either one: .

  4. 4.

    Check A = B = 1: both terms are 0, so the output is 0, as required.

Common mistakes

  • Thinking you need many operators to describe a function. AND, OR and NOT always suffice (and NAND alone does too).

  • Mixing up symbols from different notations, such as reading ∨ as AND.

Practice Boolean operator

Interactive questions with instant feedback and a worked solution for every wrong answer.

Boolean Algebra lesson

Learn it step by step

Boolean operator is taught in Boolean Algebra.