Short answer: carbonation is three small formulas. Priming sugar = (target − residual CO2) × litres × 4.0 grams of corn sugar; keg pressure = (volumes + 0.003342) ÷ (0.01821 + 0.090115·e^(−(T−32)/43.11)) − 14.695 psi; and balanced line length ≈ (keg psi − rise − 1) ÷ 2.2 feet. Put them in Excel and you bottle and keg to a number instead of by feel.

This is the deep dive on use case 17 from the 20 brewing calculations in Excel pillar, covering both bottle priming and forced carbonation, plus the line balance that decides whether it actually pours well. It connects to the data side in carbonation and dispense consistency.

Priming sugar for bottles

Beer already holds some dissolved CO2, set by the warmest temperature it reached. That residual comes off your target first:

residual =3.0378-0.050062*T+0.00026555*T^2 (T in °F) corn_sugar_g =(target_vols-residual)*litres*4.0

Example: beer that sat at 68 °F, target 2.4 volumes, 23 L → residual 0.86, sugar (2.4-0.86)*23*4.0 ≈ 141 g of corn sugar. Priming with table sugar instead? Multiply by 0.91. The single biggest mistake here is forgetting the residual term and over-priming a warm-conditioned beer into gushers.

Forced carbonation pressure

Kegging skips the sugar — you set a pressure and let the beer equilibrate. Solve the carbonation relationship for gauge pressure at your serving temperature:

=(vols+0.003342)/(0.01821+0.090115*EXP(-(T-32)/43.11))-14.695

Example: 2.5 volumes at 38 °F → about 11 psi. The chart shows why you can’t set one pressure and forget it: the colder the beer, the less pressure it takes to hold the same CO2.

Keg pressure for a target carbonation 2.0 vol2.5 vol3.0 vol 34 °F42 °F50 °F Serving temperature 26130 psi (gauge)
Each line is a target volume; pressure rises with temperature. Set the pressure for your fridge temperature, not a generic number.

Line balancing

Set the right pressure and the pour can still foam if the line is too short to bleed it off. Balance the line so its resistance roughly equals keg pressure, allowing for the climb to the tap:

length_ft =(keg_psi - rise_ft*0.5 - 1)/2.2

(3/16-inch line is ~2.2 psi/ft; 1 psi is left for pour speed.) At 11 psi with a 3 ft rise: (11 - 1.5 - 1)/2.2 ≈ 4 ft. Too short and it foams; far too long and it pours slowly — the formula gets you to the right ballpark to trim from.

Where it needs a sanity check

Two honest caveats. First, residual CO2 assumes the beer fully equilibrated at that temperature — a beer that spiked warm briefly, or one still off-gassing, won’t match, so when in doubt prime to the lower end and let conditioning finish the job. Second, line resistance is nominal — real tubing varies by bore, brand and temperature, and the 2.2 psi/ft figure is a starting point, not gospel; expect to trim an inch or two after the first pours. The formulas remove the guesswork from the target; your senses still close the last few percent.

The bottom line

Three formulas cover the whole carbonation question: how much sugar to prime, what pressure to set, and how long to cut the line. Build them once and you carbonate to a number — no more gushers, flat kegs, or all-foam pours that you can only diagnose after the fact.

Frequently asked questions

How do I calculate priming sugar in Excel? First the residual CO2 the beer already holds: =3.0378-0.050062T+0.00026555T^2 with T the warmest temperature it saw, in °F. Then corn sugar in grams =(target_volumes - residual)litres4.0. For table sugar multiply the result by 0.91.

What pressure carbonates beer to a target volume? Set keg pressure (psi gauge) =(volumes+0.003342)/(0.01821+0.090115*EXP(-(T-32)/43.11))-14.695, where T is the serving temperature in °F. For 2.5 volumes at 38 °F that gives about 11 psi. Colder beer holds CO2 more easily, so it needs less pressure.

How long should a draught beer line be? Balance the line so its resistance matches keg pressure: length in feet ≈ (keg_psi − rise×0.5 − 1) ÷ resistance, where 3/16-inch line is about 2.2 psi/ft and rise is the height to the tap. At 11 psi and 3 ft of rise that is roughly 4 ft of line for a clean, slow pour.

Part of the Brewing Science & AI track.