Neatbo.

Boolean logic minimizer

Minimize DNF, CNF or both under an explicit dont-care set, verify every care row, and keep the full truth table, variable mapping, costs and gate SVGs.

Browser-local processingInputStrict expression / dontCare / form JSONOutputExpressions / truth CSV / gate SVG / JSONUp to 0.0625 MiB per file · File limit: 1
  1. 1Add input
  2. 2Adjust settings
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input

Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.

⌘ / Ctrl + Enter to run

or drag and drop it here

Files stay on this device. Your originals stay unchanged.

.json · .txt

Up to 0.0625 MiB per file · File limit: 1

    0 characters · 0 bytes
    Options

    Complete the required options first. You can keep the defaults for the rest.

    Only the current mode’s complete source is processed; there is no automatic fallback.

    Preparing the tool…

    Before you start

    Define which inputs may change, then minimize terms or clauses before literals. The complete truth table and gate diagrams let you review every required input.

    How to use this tool

    1. Choose paste or file mode and supply the complete JSON; explicitly record expression, dontCare and form.
    2. Use ~ or !, &, ^, | and parentheses for safe Boolean expressions; check that inputs marked true by dontCare may really change.
    3. After running, check completion, equivalence on every care row, term/clause and literal costs, and the variable-to-bit/mask mapping.
    4. Download each requested form’s SVG, the full truth CSV, report, settings, expression text and original; copy a complete expression or the complete report.

    Supported inputs and limits

    Choose paste or file mode explicitly. Paste processes only active text; file mode processes exactly one original File, with no automatic fallback. Supply one complete strict UTF-8 JSON source, up to 64 KiB. The form belongs in the JSON; the workbench control selects only the input mode. One leading UTF-8 BOM is accepted and retained in the exact original; an original File name is limited to 512 UTF-8 bytes without control characters or BOM.

    JSON uses an expression string, form (dnf, cnf or both), and an optional dontCare string that defaults to False. The grammar accepts ASCII variables, True/False (also true/false), ~ or !, &, ^, | and parentheses; it never executes code. Case-sensitive identifiers match [A-Za-z_][A-Za-z0-9_]*.

    At most 8 distinct variables, each identifier at most 128 ASCII bytes; 4,096 combined tokens and 1,000 total expression/dontCare AST nodes. Parser recursion and parentheses are each limited to depth 64, including redundant parentheses.

    Variables are the union of both expressions, sorted by ASCII. Variable i binds to bit i and mask 1<<i; all at most 256 rows are enumerated. Rows where dontCare is true do not constrain the result, but retain original, dont-care and minimized values.

    Each requested form must finish an exact cover: minimum term count (clause count for CNF), then minimum literal count for equal term counts, followed by all-care-row verification. At most 6,561 candidate cubes and 10,000,000 total work units; unfinished search or any budget excess refuses the whole task.

    Download the complete truth CSV, all requested expressions, report, effective settings, exact original JSON and one complete gate SVG per requested form. The report retains all variable/bit/mask, prime/selected-cube mappings, costs and completion state. SVG shows the selected cover and does not establish minimum gate count.

    Complete files plus all full copy text are limited to 8 MiB; typed compact JSON has a separate 8 MiB limit, their aggregate 16 MiB, and binary plus complete transfer metadata 32 MiB. Memory reservation budget is 256 MiB. These guards are not measured browser-heap promises. Bounded previews never shorten exports.

    One 60-second deadline starts before source checks, native File metadata/read, loading and Worker creation, and includes full validation, cleanup and first publication after await; it never resets. Cancellation, timeout or changed input clears old success and publishes no partial or late output. Retry the same original and parameters.

    Worked example

    Example input

    {
      "expression": "(A & B) | (A & C)",
      "dontCare": "False",
      "form": "both"
    }
    
    Example options
    {"inputMode":"paste"}

    Example output

    DNF: (A & B) | (A & C)
    CNF: (B | C) & A
    

    When something does not work

    Keep the complete original and dont-care conditions. Correct JSON/grammar, variable or depth errors. If work/time is exceeded, explicitly reduce the function or request one form and record the change; an unfinished candidate is not an exact minimum. After cancellation, retry the same original File or text and parameters in a fresh Worker.

    Frequently asked questions

    Does dontCare=true require a true output?

    No. It removes that input row’s output constraint. Every care row (dontCare=false) must match the original; dont-care rows remain in the complete table.

    Do DNF and CNF need separate tools?

    No. Set form to dnf, cnf or both in the same JSON. Both runs and verifies each requested normal-form search independently within one operation.

    Does minimum term count mean minimum gates?

    No. The objective is minimum terms or clauses, then literals. The graph depicts that cover; it does not optimize multi-level logic, timing or gate count.

    What if every input is dont-care?

    The explicit empty-care policy returns DNF False and CNF True, each with zero terms/clauses and zero literals. For a nonempty universal target, the one mask-0 cube costs one term/clause and zero literals (DNF True or CNF False). The report’s constant is the final function value.

    Documentation & further reading

    Related tools