This is the guide for a bottling or kegging calculator: how much priming sugar, what pressure to set the regulator to, and, for cider and wine, how much sulfite.
19 L of beer that finished at 20 °C, to be bottled at 2.4 volumes with table sugar:
const bottles = primingSugar({
beerVolumeL: 19,
targetVolumes: 2.4,
fermentationTempC: 20,
sugar: 'table-sugar',
});
That's 111 g. The beer already holds 0.86 volumes of CO₂ from fermentation, so the sugar only has to make the rest. Corn sugar, as in Start here, takes 129 g for the same beer, because a gram of it makes less CO₂.
The same 2.4 volumes in a keg at 4 °C:
const kegPsi = pressureFromCo2Volumes(4, 2.4);
const kegBar = psiToBar(kegPsi);
10.7 PSI, or 0.74 bar.
And 20 L of cider at pH 3.5, sulfited before it's sweetened:
const cider = sulfiteDose({ volumeL: 20, ph: 3.5 });
The cider has to hold 40 mg/L of free SO₂, which takes 1.39 g of potassium metabisulfite.
primingSugarExplained and forcedCarbonationExplained return the working for the first two. Start here prints the priming explanation line by line. One of its notes is worth knowing before someone asks: a keg gets the same dose as bottles. The common advice to prime a keg with less has no source behind it, and the comment on primingSugar works through why.
sulfiteDoseExplained gives the working for the sulfite, including a note when the pH is too high for sulfite to be practical on its own.
currentFreeSo2MgL. The engine doesn't estimate it,
because it binds at a rate you can't compute.Carbonation and packaging, the method page, has the carbonation tables, the residual-CO₂ curve and the sugar yields with their sources. A blend of finished beers primes differently, because sweeter components keep fermenting in the bottle. The Blending guide covers that.