Batch Correction Calculator

About this calculator

Work out how much stock to add to an existing batch, or find out whether your stock limits make the target impossible. Enter compositions by weight. The calculator can also check whether rounding the additions to your scale increment changes the result.

Your entries stay in this browser tab.

Batch correction inputs

Enter weight percentages, where 10 means 10%, and use the same named components in every stock. Enter zero when a component is absent.

Try an example

Start with a 100 kg batch and two stocks. Check the effect of changing Stock Y from 19 kg available to 15 kg.

Components and targets

For an exact target, leave the range maximum blank.

Available stocks

Add up to four stocks. The calculator will find the smallest total addition that meets every target and limit.

Batch and scale limits (optional)

Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

How do you correct a batch using stock on hand?

Enter the existing batch mass and measured weight percentage of each tracked component. For each stock, enter the mass available and the percentage of each of those components. The calculator finds the smallest total addition that respects all the stock limits, target percentages and any maximum final mass. If the existing batch already meets the targets, the minimum addition is zero.

Worked example with two stocks

Start with 100 kg containing 10% A and 10% B. Stock X has 60% A and 10% B, with 30 kg available. Stock Y has 10% A and 50% B, with 19 kg available. The targets are exactly 20% A and 15% B.

The exact additions are 800/27 kg of stock X and 500/27 kg of stock Y, about 29.63 kg and 18.52 kg. The resulting mass is 4000/27 kg. Change stock Y's limit to 15 kg and the targets become infeasible. If the stock is available but the scale reads only whole kilograms, the nearest amounts are 30 and 19 kg. Their blend contains about 20.067% A and 15.101% B, which miss both exact targets.

Use Try an example above to load the same inputs. Read the worked example and expected outputs in JSON for a versioned record.

How the calculation works

The final mass is the existing mass plus the sum of stock additions. Each component's final mass is its starting mass plus the amounts contributed by the stocks. Dividing component mass by final mass gives its fraction by weight. A range such as 19% to 21% requires the component mass to lie between 0.19 and 0.21 times final mass. A single exact target uses the same value for both limits.

Stock availability and target ranges form a bounded linear optimization problem. The calculator checks the possible corner solutions with exact arithmetic and selects the one with the smallest total addition. If two plans add the same total mass, a stable stock-order rule selects a result. The SciPy linear programming documentation describes this type of objective and constraint. The browser calculator uses its own exact method for up to four stocks and four components.

Rounding, units and scope

Use percentages by mass. A value such as 10 means 10% of the entry's total mass. The untracked remainder accounts for unlisted material without assuming what it contains. The model assumes total mass and tracked components are conserved during mixing. It does not account for reaction, evaporation, variable composition, density or volume change.

If you enter a scale increment, the calculator checks the nearest step for each addition. It can report that those rounded amounts fail even when an exact blend exists. It does not search every possible combination at your scale's increment. The result is a mathematical check on entered values and does not establish that materials can be mixed safely or that a batch meets manufacturing requirements.

Use Recipe Scaling to resize a recipe while keeping its proportions, Molarity to work with moles per volume, or Density when you need a mass–volume conversion based on a known density.

Frequently asked questions

What does a blank maximum target mean?
The target is exact. To allow a range, enter its minimum in the target field and enter the upper bound in the optional range maximum.
Why can a blend be infeasible?
The stock limits, final batch limit or combination of composition targets might prevent every target from being met together. Review the entered limits before calculating again.
Can I share the result?
You can explicitly copy a result summary or share the calculator’s link. The link opens an empty calculator and does not contain your entries.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.