CNF and DNF Converter for Propositional Logic

Enter a proposition to generate its equivalent canonical conjunctive normal form (CNF) and disjunctive normal form (DNF), with minterm and maxterm indices and a complete verification table. Everything runs privately in your browser.

Enter a proposition

Use up to 8 variables and 500 characters. Names such as P, rain, and road_wet are accepted.

Private by design: your proposition is parsed and converted on this device. It is not uploaded, stored, or placed in the page URL.

Canonical normal forms

The example proposition is ready to convert.

Your canonical CNF, DNF, and verification table will appear here.
Press Convert to CNF and DNF or use Ctrl/⌘ + Enter.

Advertisement

Accepted propositional logic syntax

OperationAccepted inputPrecedence
NOT!P, ~P, ¬P, P', not P1 (highest)
ANDP & Q, P * Q, P ∧ Q, P and Q2
XORP ^ Q, P ⊕ Q, P xor Q3
ORP | Q, P + Q, P ∨ Q, P or Q4
ImplicationP -> Q, P => Q, P → Q, P implies Q5
BiconditionalP <-> Q, P <=> Q, P ↔ Q, P iff Q6 (lowest)

Constants 0, 1, false, and true are accepted. Separate adjacent variables with a space or operator: P Q means P ∧ Q, while PQ is one variable name. Parentheses override precedence; implication groups from right to left.

How canonical CNF and DNF conversion works

1. Parse the formula

The converter applies the displayed precedence rules and evaluates the resulting syntax tree for all 2n assignments of its n variables.

2. Build DNF from true rows

Each true row becomes a minterm. A true variable stays positive; a false variable is negated. The minterms are joined with OR.

3. Build CNF from false rows

Each false row becomes a maxterm. A false variable stays positive; a true variable is negated. The maxterms are joined with AND.

4. Verify equivalence

Every minterm is true on exactly its source row, and every maxterm is false on exactly its source row. Their combined outputs therefore match the original truth table.

Canonical, not minimized: every nonconstant term or clause contains every variable. This principal form is deterministic and useful for checking coursework, deriving circuits, and moving between truth tables and formulas. For shorter two-level forms, use the Boolean Algebra Simplifier or Karnaugh Map Simplifier.

Limits and assumptions: this tool uses classical two-valued propositional logic, preserves variable order by first appearance, and supports up to 8 variables, 500 characters, and 220 tokens. Minterm indices treat the first listed variable as the most significant bit. A tautology has canonical CNF 1; a contradiction has canonical DNF 0.

Truth-table equivalence follows OpenStax’s treatment of equivalent statements. The construction also uses the standard definitions of literals, minterms, maxterms, CNF, and DNF.

Editorial review: operator truth functions, canonical-form polarity, row indexing, constants, and representative equivalences checked by the Starlight Tools editorial team. Last reviewed: .

Worked CNF and DNF example

For P → Q, the output is false only when P = 1 and Q = 0. That false row produces the maxterm (¬P ∨ Q), so the canonical CNF is simply ¬P ∨ Q.

The true rows are 00, 01, and 11. They produce the minterms (¬P ∧ ¬Q), (¬P ∧ Q), and (P ∧ Q). Their OR is the canonical DNF.

Canonical DNF is longer here because it explicitly names every true assignment. Both forms are equivalent to the input even though only the canonical CNF happens to be short.

CNF and DNF converter FAQ

What are CNF and DNF?

Conjunctive normal form is an AND of one or more clauses, where each clause is an OR of literals. Disjunctive normal form is an OR of one or more terms, where each term is an AND of literals. A literal is a variable or its negation.

How is canonical CNF made from a truth table?

Take every false row. For each one, create an OR clause that is false on that row: use the positive literal when the row value is 0 and the negated literal when it is 1. AND all those maxterms together.

How is canonical DNF made from a truth table?

Take every true row. For each one, create an AND term that is true on that row: use the positive literal when the row value is 1 and the negated literal when it is 0. OR all those minterms together.

Are these the shortest possible normal forms?

No. These are canonical or principal forms, so every term or clause includes every variable. They are systematic and directly checkable against a truth table, but Boolean minimization can often remove literals and combine terms.

What do Σm and ΠM mean?

Σm lists the decimal indices of the true rows used as DNF minterms. ΠM lists the false-row indices used as CNF maxterms. The displayed variable order determines the binary-to-decimal index.

What happens for a tautology or contradiction?

A tautology has no false rows, so its canonical CNF is the empty conjunction, displayed as 1. A contradiction has no true rows, so its canonical DNF is the empty disjunction, displayed as 0. The other principal form still lists all assignments when variables occur.

Can I use named variables?

Yes. Names such as rain, road_wet, and alarm2 work. Reserved words including not, and, xor, or, implies, iff, true, and false act as operators or constants.

Does the converter store my formula?

No. Parsing, truth-table evaluation, conversion, copying, and text-file creation happen locally in your browser. The tool does not transmit or save the entered formula.

Explore more tools