Home / Calculators / 0/1 Knapsack Solver
Free online tool

0/1 Knapsack Solver

Select items that maximize value without exceeding a capacity. Processing takes place locally in your browser.

Start using

What 0/1 Knapsack Solver does

Select items that maximize value without exceeding a capacity.

Worked example

Input

Weights 2,3,4; values 4,5,7; capacity 5

Result

Select weights 2 and 3 for value 9

Calculation method

Dynamic programming records the best value reachable for each item prefix and capacity, then traces chosen items.

Useful workflows

  • Check a small teaching example and inspect intermediate results.
  • Compare an independently calculated answer or software test fixture.
  • Copy the result together with its input notation and selected options.

Limits and review checks

  • Combinatorial, graph and search problems can grow exponentially and are intentionally size-limited.
  • Confirm integer, modular, set-order, precision and rounding assumptions before comparing answers.
  • Cryptography-related pages are educational demonstrations and must not generate or validate production security keys.

Frequently asked questions

Why is my input rejected?

Check separators, variable names, supported operators, numeric ranges and whether the selected algorithm requires integers.

Can I use this result in a high-stakes decision?

Use the tool for learning and independent checks. Verify legal, financial, safety or security decisions with an authoritative method and qualified reviewer.

Processing takes place locally in your browser.