Skip to main content

CNF/DNF Converter

Our free logic & computer science calculator solves cnfdnfconverter problems. Get worked examples, visual aids, and downloadable results.

Skip to calculator
Mathematics

CNF/DNF Converter

Convert Boolean functions between CNF (Conjunctive Normal Form) and DNF (Disjunctive Normal Form). Generate truth tables, minterms, maxterms, and complement functions.

Last updated: December 2025Reviewed by NovaCalculator Mathematics Team

Calculator

Adjust values & calculate
Valid range: 0 to 7
DNF (Disjunctive Normal Form / SOP)
A'B'C + A'BC + AB'C + ABC
Sum(1,3,5,7) | 4 terms, 12 literals
CNF (Conjunctive Normal Form / POS)
(A+B+C)(A+B'+C)(A'+B+C)(A'+B'+C)
Prod(0,2,4,6) | 4 clauses, 12 literals
Function Type
Contingency
Satisfying
4/8
SAT %
50.0%

Truth Table

#ABCFType
00000M0
10011m1
20100M2
30111m3
41000M4
51011m5
61100M6
71111m7

Complement Function (F')

F' in DNF
A'B'C' + A'BC' + AB'C' + ABC'
F' in CNF
(A+B+C')(A+B'+C')(A'+B+C')(A'+B'+C')
Your Result
DNF: A'B'C + A'BC + AB'C + ABC | CNF: (A+B+C)(A+B'+C)(A'+B+C)(A'+B'+C) | Contingency
Share Your Result
Understand the Math

Formula

DNF = OR(minterms) | CNF = AND(maxterms)

DNF (Disjunctive Normal Form) represents a function as an OR of AND terms (minterms), each corresponding to a truth table row with output 1. CNF (Conjunctive Normal Form) represents a function as an AND of OR terms (maxterms), each corresponding to a row with output 0. Together they are dual canonical representations.

Last reviewed: December 2025

Worked Examples

Example 1: CNF/DNF for F(A,B,C) = Sum(1,3,5,7)

Express the function with minterms 1,3,5,7 in both CNF and DNF form.
Solution:
All minterms have C=1: m1=001, m3=011, m5=101, m7=111 DNF: A'B'C + A'BC + AB'C + ABC Maxterms (0-rows): 0,2,4,6 (all have C=0) CNF: (A+B+C)(A+B'+C)(A'+B+C)(A'+B'+C) Note: Both forms simplify to F = C
Result: DNF: A'B'C + A'BC + AB'C + ABC | CNF: (A+B+C)(A+B'+C)(A'+B+C)(A'+B'+C)

Example 2: Complement Function

Find F and F' for F(A,B) = Sum(0,3).
Solution:
F minterms: 0(A'B'), 3(AB) F DNF: A'B' + AB F maxterms: 1,2 F CNF: (A+B')(A'+B) F' minterms: 1(A'B), 2(AB') F' DNF: A'B + AB' F' CNF: (A+B)(A'+B') Note: F = XNOR, F' = XOR
Result: F = A'B' + AB (XNOR) | F' = A'B + AB' (XOR)
Expert Insights

Background & Theory

The CNF/DNF Converter applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.

History

The history behind the CNF/DNF Converter traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.

Share this calculator

Explore More

Frequently Asked Questions

CNF (Conjunctive Normal Form) is a standardized way to write a Boolean expression as an AND (conjunction) of OR (disjunction) clauses. Each clause contains one or more literals (variables or their negations) connected by OR. For example, (A OR B) AND (A' OR C) AND (B OR C') is in CNF. In the context of truth tables, CNF is equivalent to the Product of Sums (POS) canonical form, where each clause (maxterm) corresponds to a truth table row with output 0. CNF is the standard form used in SAT solvers, automated theorem provers, and formal verification tools because many efficient algorithms are specifically designed to operate on CNF formulas.
DNF (Disjunctive Normal Form) is a standardized way to write a Boolean expression as an OR (disjunction) of AND (conjunction) terms. Each term contains one or more literals connected by AND. For example, (A AND B) OR (A' AND C) OR (B AND C') is in DNF. In truth table terms, DNF is equivalent to the Sum of Products (SOP) canonical form, where each product term (minterm) corresponds to a row with output 1. DNF is particularly useful for understanding when a function evaluates to true: the function is true whenever any single term is satisfied. While DNF is natural for human understanding, many computational problems are harder in DNF than CNF form.
Converting between CNF and DNF requires expanding one form into the other using the distributive law. To convert CNF to DNF, distribute AND over OR by multiplying out all the clauses. For example, (A+B)(C+D) becomes AC + AD + BC + BD. This expansion can cause an exponential blowup: a CNF with k clauses of m literals each can produce up to m^k terms in DNF. The reverse direction (DNF to CNF) also uses distribution but distributes OR over AND. Because direct conversion can be exponential, the practical approach is often to go through the truth table: enumerate all rows, identify minterms for DNF and maxterms for CNF, and then apply minimization algorithms.
DNF and CNF are directly related to minterms and maxterms respectively. A canonical DNF lists all minterms (product terms where the function equals 1), connected by OR. Each minterm includes every variable exactly once, either normal or complemented. A canonical CNF lists all maxterms (sum terms where the function equals 0), connected by AND. Each maxterm includes every variable once, but with opposite complementation compared to the minterm of the same index. Minterm m_i and maxterm M_i are complements: m_i corresponds to the binary encoding of i with 1 meaning normal and 0 meaning complemented, while M_i uses the opposite convention. Together they completely describe a Boolean function.
CNF is the standard input format for SAT (Boolean Satisfiability) solvers, which determine whether a Boolean formula can be made true by some assignment of variables. Modern SAT solvers like MiniSat, CaDiCaL, and Kissat are among the most successful practical algorithms in computer science, solving problems with millions of variables and clauses. CNF is preferred because unit propagation (if a clause has only one unset literal, that literal must be true) and clause learning work naturally in CNF form. SAT solvers are used in hardware verification, software testing, AI planning, cryptanalysis, and combinatorial optimization. The Cook-Levin theorem proves that CNF-SAT is NP-complete, making it theoretically universal for NP problems.
The complement (negation) of a Boolean function swaps all 1-outputs with 0-outputs and vice versa. In terms of normal forms: the complement of F in DNF has its minterms become the maxterms of F (the original 0-rows become 1-rows). If F = Sum(1,3,5) for 3 variables, then F' = Sum(0,2,4,6,7). De Morgan laws provide the algebraic method: the complement of a DNF is obtained by replacing AND with OR, OR with AND, and complementing each literal. For example, (AB + CD)' = (A'+B')(C'+D'). Similarly, the complement of a CNF expression applies De Morgan laws to produce a DNF. This duality between CNF and DNF under complementation is a fundamental property of Boolean algebra.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings.Reviewed by: NovaCalculator Mathematics Team โ€” Verified against standard mathematical and scientific references. Last reviewed: December 2025. ยฉ 2024โ€“2026 NovaCalculator.

Share this calculator

Formula

DNF = OR(minterms) | CNF = AND(maxterms)

DNF (Disjunctive Normal Form) represents a function as an OR of AND terms (minterms), each corresponding to a truth table row with output 1. CNF (Conjunctive Normal Form) represents a function as an AND of OR terms (maxterms), each corresponding to a row with output 0. Together they are dual canonical representations.

Worked Examples

Example 1: CNF/DNF for F(A,B,C) = Sum(1,3,5,7)

Problem: Express the function with minterms 1,3,5,7 in both CNF and DNF form.

Solution: All minterms have C=1: m1=001, m3=011, m5=101, m7=111\nDNF: A'B'C + A'BC + AB'C + ABC\nMaxterms (0-rows): 0,2,4,6 (all have C=0)\nCNF: (A+B+C)(A+B'+C)(A'+B+C)(A'+B'+C)\nNote: Both forms simplify to F = C

Result: DNF: A'B'C + A'BC + AB'C + ABC | CNF: (A+B+C)(A+B'+C)(A'+B+C)(A'+B'+C)

Example 2: Complement Function

Problem: Find F and F' for F(A,B) = Sum(0,3).

Solution: F minterms: 0(A'B'), 3(AB)\nF DNF: A'B' + AB\nF maxterms: 1,2\nF CNF: (A+B')(A'+B)\n\nF' minterms: 1(A'B), 2(AB')\nF' DNF: A'B + AB'\nF' CNF: (A+B)(A'+B')\nNote: F = XNOR, F' = XOR

Result: F = A'B' + AB (XNOR) | F' = A'B + AB' (XOR)

Frequently Asked Questions

What is CNF (Conjunctive Normal Form)?

CNF (Conjunctive Normal Form) is a standardized way to write a Boolean expression as an AND (conjunction) of OR (disjunction) clauses. Each clause contains one or more literals (variables or their negations) connected by OR. For example, (A OR B) AND (A' OR C) AND (B OR C') is in CNF. In the context of truth tables, CNF is equivalent to the Product of Sums (POS) canonical form, where each clause (maxterm) corresponds to a truth table row with output 0. CNF is the standard form used in SAT solvers, automated theorem provers, and formal verification tools because many efficient algorithms are specifically designed to operate on CNF formulas.

What is DNF (Disjunctive Normal Form)?

DNF (Disjunctive Normal Form) is a standardized way to write a Boolean expression as an OR (disjunction) of AND (conjunction) terms. Each term contains one or more literals connected by AND. For example, (A AND B) OR (A' AND C) OR (B AND C') is in DNF. In truth table terms, DNF is equivalent to the Sum of Products (SOP) canonical form, where each product term (minterm) corresponds to a row with output 1. DNF is particularly useful for understanding when a function evaluates to true: the function is true whenever any single term is satisfied. While DNF is natural for human understanding, many computational problems are harder in DNF than CNF form.

How do you convert between CNF and DNF?

Converting between CNF and DNF requires expanding one form into the other using the distributive law. To convert CNF to DNF, distribute AND over OR by multiplying out all the clauses. For example, (A+B)(C+D) becomes AC + AD + BC + BD. This expansion can cause an exponential blowup: a CNF with k clauses of m literals each can produce up to m^k terms in DNF. The reverse direction (DNF to CNF) also uses distribution but distributes OR over AND. Because direct conversion can be exponential, the practical approach is often to go through the truth table: enumerate all rows, identify minterms for DNF and maxterms for CNF, and then apply minimization algorithms.

What is the relationship between CNF/DNF and minterms/maxterms?

DNF and CNF are directly related to minterms and maxterms respectively. A canonical DNF lists all minterms (product terms where the function equals 1), connected by OR. Each minterm includes every variable exactly once, either normal or complemented. A canonical CNF lists all maxterms (sum terms where the function equals 0), connected by AND. Each maxterm includes every variable once, but with opposite complementation compared to the minterm of the same index. Minterm m_i and maxterm M_i are complements: m_i corresponds to the binary encoding of i with 1 meaning normal and 0 meaning complemented, while M_i uses the opposite convention. Together they completely describe a Boolean function.

Why is CNF important in computational logic and SAT solving?

CNF is the standard input format for SAT (Boolean Satisfiability) solvers, which determine whether a Boolean formula can be made true by some assignment of variables. Modern SAT solvers like MiniSat, CaDiCaL, and Kissat are among the most successful practical algorithms in computer science, solving problems with millions of variables and clauses. CNF is preferred because unit propagation (if a clause has only one unset literal, that literal must be true) and clause learning work naturally in CNF form. SAT solvers are used in hardware verification, software testing, AI planning, cryptanalysis, and combinatorial optimization. The Cook-Levin theorem proves that CNF-SAT is NP-complete, making it theoretically universal for NP problems.

What is the complement of a Boolean function in CNF/DNF?

The complement (negation) of a Boolean function swaps all 1-outputs with 0-outputs and vice versa. In terms of normal forms: the complement of F in DNF has its minterms become the maxterms of F (the original 0-rows become 1-rows). If F = Sum(1,3,5) for 3 variables, then F' = Sum(0,2,4,6,7). De Morgan laws provide the algebraic method: the complement of a DNF is obtained by replacing AND with OR, OR with AND, and complementing each literal. For example, (AB + CD)' = (A'+B')(C'+D'). Similarly, the complement of a CNF expression applies De Morgan laws to produce a DNF. This duality between CNF and DNF under complementation is a fundamental property of Boolean algebra.

References

Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy