Skip to content

What is Boolean logic? A plain-English guide with examples from search, code and circuits

Boolean logic is the logic of true and false. Every statement has one of two values, and AND, OR and NOT combine statements into larger ones. It runs search boxes, program conditions, spreadsheet formulas and digital circuits, and is named after the mathematician George Boole.

This guide explains the idea in plain English: the three basic operators with their truth tables, what Boolean variables and expressions are, where you meet them every day, the order in which the operators apply, and the everyday words that trip people up. Every example that compares two expressions links to a free checker that tests them on every possible combination of true and false.

Boolean logic in one paragraph

In Boolean logic a value is either true or false, with nothing in between. A statement such as “it is raining” or “the user is an admin” is a Boolean value: at any moment it is one or the other. Statements combine with three basic operators. NOT flips a value, AND is true only when both sides are true, and OR is true when at least one side is. From those three, any rule that takes yes-or-no inputs and gives a yes-or-no answer can be written, which is why the same logic appears in search engines, programs, spreadsheets and chips. True and false are often written 1 and 0, and in circuits they are a high and a low voltage.

Why it is called Boolean

George Boole (1815–1864) was an English mathematician, and later the first professor of mathematics at Queen's College Cork in Ireland. In The Mathematical Analysis of Logic (1847) and An Investigation of the Laws of Thought (1854) he showed that reasoning could be written as algebra: symbols for classes and statements, combined by rules much like multiplication and addition, with 1 standing for “everything” and 0 for “nothing”. His algebra was later named Boolean algebra after him.

For decades it was a branch of mathematics and philosophy. Then in 1937 Claude Shannon, a student at MIT, showed in his master's thesis that circuits of relays and switches obey Boolean algebra, so a circuit could be designed on paper with Boole's rules. Every digital computer since has been built on that idea.

Two questions people search for:

  • Is Boolean capitalized? Usually, yes, because it comes from a person's name, like Euclidean or Cartesian. In code, the type is written however the language spells it: boolean in Java, bool in Python, C++ and C#, and Boolean for JavaScript's wrapper object.
  • How do you pronounce Boolean? BOO-lee-un, with the stress on the first syllable, the way Boole is said.

True, false and the three basic operators

A truth table lists every combination of true and false for the inputs and the result for each. With two inputs there are four combinations. Here are the three basic operators; T is true, F is false, and row 0 has both inputs false:

Truth table: NOT A, A AND B, A OR B
#ABNOT AA AND BA OR B
0FALSEFALSETRUEFALSEFALSE
1FALSETRUETRUEFALSETRUE
2TRUEFALSEFALSEFALSETRUE
3TRUETRUEFALSETRUETRUE

Computed by the Tangibool engine

  • NOT turns true into false and false into true. “The door is NOT locked” is true exactly when “the door is locked” is false. It is also written ¬A, !A or A′.
  • AND is true only when both sides are true: row 3. “Over 18 AND has a ticket” admits only people who are both. It is also written A ∧ B, A && B or A·B.
  • OR is true when at least one side is true, including when both are: rows 1, 2 and 3. “Member OR guest” admits either, and a person who is both. It is also written A ∨ B, A || B or A + B.

The operators page has these and the other common operators, XOR, NAND, NOR, XNOR, implication and the biconditional, each with tables for two, three and four inputs.

Boolean variables and Boolean expressions

A Boolean variable is a name for a value that can only be true or false: raining, is_admin, has_ticket. In code it is a variable of the Boolean type; in a rule it is one yes-or-no condition.

A Boolean expression combines Boolean variables, the values true and false, and operators into something that is itself true or false once the variables have values. has_ticket AND NOT banned is a Boolean expression; so is age_ok AND (member OR coupon) AND NOT expired. Comparisons such as age >= 18 also produce Boolean values, so in programming they count as Boolean expressions too. A Boolean expression with n variables has 2ⁿ possible combinations of inputs, and its truth table lists them all. The truth table generator does that for the second example: 16 rows, and the expression is true on three of them.

Different expressions can describe the same rule. member OR (member AND paid) is true exactly when member is, which the Boolean simplifier finds in one step, the absorption law, and the equivalence checker confirms. The rule itself, as opposed to any one way of writing it, is called a Boolean function.

Where you meet Boolean logic

Library catalogues, research databases and many site searches take AND, OR and NOT. python AND (tutorial OR course) AND NOT snake finds pages about Python tutorials or courses that do not mention snakes. AND narrows a search, OR widens it, and NOT removes results. Parentheses matter: without them, python AND tutorial OR course is read as (python AND tutorial) OR course, which also returns every page about any course. The equivalence checker shows the two readings differ, for example on a page that mentions a course and nothing else. A grouped search can also be spread out: the search above means the same as two searches joined by OR.

Google treats a space as AND, understands OR in capitals, and uses a minus sign for NOT, as in python -snake.

In code

Every if statement tests a Boolean expression: if (isAdmin || isOwner) && !locked in many languages, or if (is_admin or is_owner) and not locked: in Python. Two things to know:

  • Short-circuiting. Most languages stop as soon as the answer is known: in a && b, if a is false, b is never evaluated. That matters when b has a side effect or would crash.
  • Negating a condition. To write “otherwise”, negate the whole condition with De Morgan's laws: NOT flips each part and swaps AND with OR. The negation of (is_admin OR is_owner) AND NOT locked is (NOT is_admin AND NOT is_owner) OR locked. Flipping the parts without swapping the operators gives a different rule, wrong on the very first row, where all three are false. The De Morgan in code example shows the rewrite on a shorter condition.

Some languages, JavaScript and Python among them, also treat values that are not true or false as Boolean in a condition. In both, 0 and the empty string count as false; Python also counts an empty list as false, while JavaScript counts it as true. The pages on JavaScript and Python list the rules.

In spreadsheets

Excel and Google Sheets have the functions AND, OR and NOT, usually inside IF: =IF(AND(B2>=18, OR(C2="member", D2="coupon")), "Yes", "No"). The Excel page gives the function names in English and Spanish.

In circuits

A computer chip is billions of tiny switches arranged as logic gates, each of which computes one Boolean operator on voltages. An AND gate outputs a high voltage only when both its inputs are high. Adding two numbers, comparing them and storing them are all done with Boolean logic in hardware.

In rules and decisions

Eligibility rules, access rules and feature flags are Boolean expressions written in words: “approve the loan if income is sufficient and the credit check passes or there is a guarantor, and the applicant is not bankrupt”. The loan eligibility example writes that rule as an expression and tests it, and the testing section shows how such rules become test cases.

Order of operations: NOT, then AND, then OR

When an expression has no parentheses, NOT applies first, then AND, then OR, just as multiplication comes before addition in arithmetic. So member OR guest AND paid means member OR (guest AND paid), a member, or a guest who has paid. The equivalence checker confirms that reading. If you meant “(member or guest), and paid”, you need the parentheses, because the two readings differ:

Truth table: member OR (guest AND paid), (member OR guest) AND paid
#memberguestpaidmember OR (guest AND paid)(member OR guest) AND paid
0FALSEFALSEFALSEFALSEFALSE
1FALSEFALSETRUEFALSEFALSE
2FALSETRUEFALSEFALSEFALSE
3FALSETRUETRUETRUETRUE
4TRUEFALSEFALSETRUEFALSE
5TRUEFALSETRUETRUETRUE
6TRUETRUEFALSETRUEFALSE
7TRUETRUETRUETRUETRUE

Computed by the Tangibool engine

They part on rows 4 and 6, where the person is a member who has not paid. The first reading admits them and the second does not; the equivalence checker gives row 4 as its counterexample. When in doubt, add parentheses: they cost nothing. The precedence page lists the full order, including XOR and implication, and the AND–OR grouping slip shows the mistake in a real rule.

A worked example: from a sentence to an expression

Turning a rule written in words into Boolean logic takes four steps. Take a shop's delivery rule:

Orders ship free when they are over £50 or the customer is a member, unless the item is oversized.

1. Name the yes-or-no conditions. over_50 (the order is over £50), member (the customer is a member) and oversized (the item is oversized). Each is true or false for any given order.

2. Find the operators in the words. “Or” joins the two ways to qualify. “Unless” adds an exception, which in a rule is AND NOT. The exception applies to both ways of qualifying, so the “or” part needs parentheses:

free_shipping = (over_50 OR member) AND NOT oversized

3. Check the truth table. Three conditions give 2³ = 8 combinations:

Truth table: free shipping
#over_50memberoversizedfree shipping
0FALSEFALSEFALSEFALSE
1FALSEFALSETRUEFALSE
2FALSETRUEFALSETRUE
3FALSETRUETRUEFALSE
4TRUEFALSEFALSETRUE
5TRUEFALSETRUEFALSE
6TRUETRUEFALSETRUE
7TRUETRUETRUEFALSE

Computed by the Tangibool engine

Shipping is free on rows 2, 4 and 6: at least one way to qualify, and not oversized. Reading each row aloud as an order is the quickest way to catch a rule that says something you did not mean, and the eight rows are also the test cases a program implementing the rule should pass.

4. Check any rewrite. A developer might write the rule as two cases, (over_50 AND NOT oversized) OR (member AND NOT oversized), and the equivalence checker confirms it is the same rule. Dropping the parentheses is not: over_50 OR member AND NOT oversized means over_50 OR (member AND NOT oversized), and the equivalence checker finds the order where they differ, over_50 = T, member = F, oversized = T: an oversized £60 sofa that would ship free. The truth table generator shows the full table with a plain-English reading, and the free shipping example adds a fourth condition, domestic delivery.

Three everyday words that trip people up

  • “Or” in English is often exclusive. “Tea or coffee?” offers one or the other, not both. Boolean OR includes both, so “tea OR coffee” is true when someone has both, and the exclusive version is XOR. The equivalence checker shows they differ only on that row, tea = T, coffee = T. See inclusive vs exclusive or.
  • “Neither … nor” is NOT (A OR B). “Neither rain nor snow” means not rain and not snow: NOT (rain OR snow) is NOT rain AND NOT snow. Writing NOT rain OR NOT snow says “not both”, a different rule that is true on a snowy day without rain. See neither … nor.
  • “Unless” is AND NOT in a rule. “Members may enter unless they are banned” admits members who are not banned: member AND NOT banned. The textbook reading of “A unless B” as A OR B is a statement that one of the two holds, which is not an admission rule: the two differ, for example on someone banned who is not a member. See what “unless” means.

The laws of Boolean logic

Boolean logic has laws, like the laws of arithmetic, that say when two expressions mean the same thing. They are how expressions are simplified and how a condition is rewritten without changing what it does:

LawExampleIn words
IdentityA AND TRUE = AAND with true changes nothing
ComplementA OR NOT A = TRUEsomething is either so or not so
Double negationNOT NOT A = Atwo negations cancel
De MorganNOT (A AND B) = NOT A OR NOT B“not both” is “at least one is not”
DistributiveA AND (B OR C) = (A AND B) OR (A AND C)AND spreads over OR
AbsorptionA OR (A AND B) = Athe extra condition adds nothing

An expression that is true on every row is a tautology, such as raining OR NOT raining. One that is false on every row is a contradiction, such as raining AND NOT raining. A rule that turns out to be either usually has a mistake in it. The laws section proves every law with a truth table.

Boolean logic, Boolean algebra and propositional logic

The three names overlap. Boolean algebra is the mathematics: the values 0 and 1, the operators, and the laws, usually written with · for AND, + for OR and a prime or bar for NOT. Propositional logic is the same structure studied as logic, with statements, ∧, ∨, ¬ and →, and with arguments, proofs and validity. Boolean logic is the everyday name for both, especially in computing and search. The comparison page sets the two notations side by side.

Two extensions are worth knowing about. Predicate logic adds “for all” and “there exists”, which Boolean logic does not have. And SQL databases use three values, true, false and unknown, because a missing value (NULL) is neither true nor false; the NULL is not false page explains what that does to AND, OR and NOT.

Common mistakes

  1. Reading OR as exclusive. Boolean OR includes the case where both sides are true. Use XOR for “one or the other but not both”.
  2. Leaving out parentheses. AND applies before OR, so A OR B AND C is A OR (B AND C).
  3. Negating part by part. NOT (A AND B) is NOT A OR NOT B, not NOT A AND NOT B. Swap the operator when the NOT goes inside.
  4. Translating “and” in a list as AND. “Students and seniors get a discount” admits either group, so it is student OR senior. The AND operator page shows the row where the two readings differ.
  5. Comparing with = in a formula. In Boolean logic “has the same value as” is ↔ (the biconditional), and “differs from” is XOR; see “=” is not a Boolean operator.

Try it yourself

  1. Write a rule you use with yes-or-no conditions, for example age_ok AND (member OR coupon) AND NOT expired. Use AND, OR, NOT and parentheses, or the symbols ∧, ∨ and ¬.
  2. Paste it into the truth table generator to see every combination of inputs and a plain-English reading of the rule.
  3. If you rewrite the rule, put both versions into the equivalence checker. It says whether they are the same rule and, if not, shows a combination where they differ.

Frequently asked questions

What is Boolean logic in simple terms?

A way of working with statements that are either true or false, using AND, OR and NOT to combine them. A search for “cats AND dogs”, an if statement in a program and a light controlled by two switches all use it.

Why is it called Boolean logic?

After George Boole, the English mathematician who showed in 1847 and 1854 that logic could be written and calculated as algebra.

Who invented Boolean logic?

George Boole, in two books of 1847 and 1854. Claude Shannon applied it to electrical circuits in 1937, which is how it came to run computers.

What is an example of Boolean logic?

A shop rule such as “free shipping when the order is over £50 or the customer is a member, unless the item is oversized”, which is (over_50 OR member) AND NOT oversized. A search for python AND NOT snake is another.

Is Boolean capitalized?

Usually, because it comes from Boole's name. In program code the type keeps the spelling of the language, such as boolean in Java or bool in Python.

How do you pronounce Boolean?

BOO-lee-un.

What is a Boolean expression?

A combination of Boolean variables, the values true and false, and operators such as AND, OR and NOT, which is itself true or false once the variables have values. has_ticket AND NOT banned is one.

What is a Boolean variable?

A variable that can hold only true or false, such as is_admin or raining.

What are the basic Boolean operators?

AND, OR and NOT. XOR, NAND, NOR and implication are common too, and all of them can be written with the first three.

What is the difference between Boolean logic and Boolean algebra?

Boolean algebra is the mathematical system, with 0, 1 and laws such as De Morgan's. Boolean logic usually means the same ideas applied to statements, conditions and searches.

Where is Boolean logic used?

In computer chips, programming languages, databases, search engines, spreadsheets, and in the business rules that decide things such as who gets a discount.

Is Boolean logic the same as binary?

They are related but not the same. Binary is a way of writing numbers with the digits 0 and 1; Boolean logic is about combining true and false values. Computers use both, and a bit can be read either way.

Written by Muaz Notiar. The Tangibool engine (semantics tangibool-semantics/1, engine 1.0.0) computed the 3 truth tables marked “Computed by the Tangibool engine”, and the 18 tool results the guide links to were re-run through the tools' own code in the build of and match what the text says. © 2026 Foreranger LTD.