# Looking for Headspace vs Beer CO2 Calculation

### Help Support Homebrew Talk:

#### VikeMan

##### It ain't all burritos and strippers, my friend.
I'm looking for a general formula that...

given a sealed container with a specified volume of beer, and a specified volume of headspace

... gives the % of the total CO2 (by weight) that is in the beer and (thus) the % of the total CO2 (by weight) that is in the headspace, assuming equilibrium has been reached.

Anyone? TIA!

Last edited:

#### day_trippr

##### Bastard-covered bastard with bastard filling
If it's out there, @doug293cz likely knows it.

Cheers! (no pressure, doug )

#### MMP126

##### Lotsa Dude's Thumbs On Here...
Just spit balling here...

In the headspace, you would essentially CO2 at STP (assuming you arent spunding).

CO2 = 44g/mol

Say headspace is 20% of 6.5gal = 1.3gal = 4.92L

Avogadro's law I think applies here. V=kn

V = headspace volume = 4.92L
k = 22.71 L/mol
n = number of moles = (X)grams / (44mol/g)

4.92 = (22.71) (x/44)

x = 9.53g

So, thats the first part...

The end part I think is a little harder. You will have a pressure gradient across the volume of the wort/beer due to gravity. It may be small but its there, and more prevalent with increased fermentation volume.

I hope this is what you are after. I may take a stab at that tomorrow. Bed now...

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
In the headspace, you would essentially CO2 at STP (assuming you arent spunding).
Thanks! But this (i.e. the formula I'm looking for) is for a sealed container, like a bottle of beer, for example. (Not a fermenter).

Last edited:

#### MMP126

##### Lotsa Dude's Thumbs On Here...
Thanks! But this is for a sealed container, like a bottle of beer, for example. (Not a fermenter).
Same rules apply, just change the volume (V in the equation) to whatever headspace you have.

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
Same rules apply, just change the volume (V in the equation) to whatever headspace you have.
Not sure I'm following. Are you saying the CO2 in the headspace of a carbonated bottle of beer will be at standard pressure?

#### MMP126

##### Lotsa Dude's Thumbs On Here...
Ah, I see. No, it is not. Assuming its at like 15psig, the ideal gas law would come into play. PV=nRT

But, that all I got for now. Bed for real this time.

But, this intrigues me, so Ill take some more cracks tomorrow! Not sure why you need the info, but I think stuff like this is fun!

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
I don't know of a simple formula for solving this. I use a spreadsheet with the "Goal Seek" functionality to iterate the headspace vs. beer equilibrium. I'll put something up on Tuesday.

Brew on

.

Last edited:

#### MMP126

##### Lotsa Dude's Thumbs On Here...
Going back to the amount of CO2 in the beer. 1 vol of CO2 = 1.96g/L

Making some assumptions. The beer is carbed to 2.5vol at 40F. This gives a carb pressure of about 12psig.

So, say you have a 12oz bottle with 2oz of headspace, and 10oz of beer. 10oz = 0.295L. Carbonated to 2.5vol, you would have 1.45g of CO2 in the beer.

The headspace of the bottle, 2oz, you can use the ideal gas law. Which coincides with a density relationship.

d = P/RT

d = density (slugs/ft^3)
P = pressure = 12psig + 14.7 = 28.7psia = 4133psf
R = gas constant for CO2 = 1130ft-lb/slug-R
T = 40F = 500R

d = 0.0073 slugs/ft^3

and we can use a specific weight equation to get our final weight of the CO2 in the headspace

w = dgV

w = weight (lb)
d = density (from above)
g = gravity = 32.2ft/s
V = headspace volume = ASSUME 4 in^3 (not sure on this one, may have to get a good measurement here) = 0.0023ft^3

w = 0.00054 lb = 0.25g

As a note, this is assuming that this is at a constant temperature.

SO! From the knowledge that I have. A 12oz bottle of beer at 40F, carbed to 2.5 vol, will have about 1.7g of CO2 in it...

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
Going back to the amount of CO2 in the beer. 1 vol of CO2 = 1.96g/L

Making some assumptions. The beer is carbed to 2.5vol at 40F. This gives a carb pressure of about 12psig.

So, say you have a 12oz bottle with 2oz of headspace, and 10oz of beer. 10oz = 0.295L. Carbonated to 2.5vol, you would have 1.45g of CO2 in the beer.

The headspace of the bottle, 2oz, you can use the ideal gas law. Which coincides with a density relationship.

d = P/RT

d = density (slugs/ft^3)
P = pressure = 12psig + 14.7 = 28.7psia = 4133psf
R = gas constant for CO2 = 1130ft-lb/slug-R
T = 40F = 500R

d = 0.0073 slugs/ft^3

and we can use a specific weight equation to get our final weight of the CO2 in the headspace

w = dgV

w = weight (lb)
d = density (from above)
g = gravity = 32.2ft/s
V = headspace volume = ASSUME 4 in^3 (not sure on this one, may have to get a good measurement here) = 0.0023ft^3

w = 0.00054 lb = 0.25g

As a note, this is assuming that this is at a constant temperature.

SO! From the knowledge that I have. A 12oz bottle of beer at 40F, carbed to 2.5 vol, will have about 1.7g of CO2 in it...
"Slugs"??

Brew on

#### MMP126

##### Lotsa Dude's Thumbs On Here...
Yeah man.

slug = lbf-s^2/ft

Customary unit of mass. SI has kilograms, US customary has slugs.

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
Yeah man.

slug = lbf-s^2/ft

Customary unit of mass. SI has kilograms, US customary has slugs.
I know what it is, just haven't seen anyone use it in decades.

Brew on

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
I'm looking for a general formula that...

given a sealed container with a specified volume of beer, and a specified volume of headspace

... gives the % of the total CO2 (by weight) that is in the beer and (thus) the % of the total CO2 (by weight) that is in the headspace, assuming equilibrium has been reached.

Anyone? TIA!
Will have to specify:
• Temperature
• Beer Volume
• and probably Carbonation Level
A few test calculations should show if CO2 ratio in the two volumes is independent of carb level or not.

Brew on

#### MMP126

##### Lotsa Dude's Thumbs On Here...
I know what it is, just haven't seen anyone use it in decades.

Brew on
Dont forget blobs... 1 blob = 12 slugs

America is funny...

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
Dont forget blobs... 1 blob = 12 slugs

America is funny...
That's one I didn't know.

Brew on

#### Gruel

##### Well-Known Member
And R must be Rankine, not Reaumur, I guess? It makes sense that somebody had to invent a Fahrenheit-based absolute temperature scale.
After all these years, these units still amaze me. And it still seems like a good way to land a spacecraft below the surface... which of course is unfair. It's just the unit conversion, or lack thereof, that led to that result.

I had to convince myself that MMP's numbers work out to the same result when doing the gymnastics in metric: 2 fluid ounces of head space ~ 60cm^3 ~ 1/16 L; 22 L of CO2 ~ 44 gram => 1 L = 2 g; 1/16L at about 2 atmospheres absolute pressure ~ 1/16 * 2 * 2 g = 1/4 g; and in the fluid 2.5* 10 fluid ounces = 2.5 * 0.3L = 0.75L ~ 1.5 gram.

But I'd assume the pressure above the beer in the bottle depends on the current temperature and the original carbonation pressure and temperature of the beer.

#### MMP126

##### Lotsa Dude's Thumbs On Here...
And R must be Rankine, not Reaumur, I guess? It makes sense that somebody had to invent a Fahrenheit-based absolute temperature scale.
After all these years, these units still amaze me. And it still seems like a good way to land a spacecraft below the surface... which of course is unfair. It's just the unit conversion, or lack thereof, that led to that result.

I had to convince myself that MMP's numbers work out to the same result when doing the gymnastics in metric: 2 fluid ounces of head space ~ 60cm^3 ~ 1/16 L; 22 L of CO2 ~ 44 gram => 1 L = 2 g; 1/16L at about 2 atmospheres absolute pressure ~ 1/16 * 2 * 2 g = 1/4 g; and in the fluid 2.5* 10 fluid ounces = 2.5 * 0.3L = 0.75L ~ 1.5 gram.

But I'd assume the pressure above the beer in the bottle depends on the current temperature and the original carbonation pressure and temperature of the beer.
Yeah, R is Rankine.

The pressure in the headspace would change with increases and decreases in temperature. But, if the system is closed (capped bottle), I would venture to say the amount of CO2 in the bottle would stay the same. Just slightly different amounts of CO2 in the headspace vs. the beer.

Also, just a thought. If you filled the bottle from a keg, you would only have the CO2 from the beer, and nothing in the headspace, since that would just be air until CO2 degassed from the beer and filled/pressurized the headspace. But, I may be splitting hairs here, as I am not sure how detailed we want to get.

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
@MMP126 Thanks! This is very helpful.

One thing...

P = pressure = 12psig + 14.7 = 28.7psia = 4133psf
Should read ... 12psig + 14.7 = 26.7psia = 3884psf
Right?

Thanks again!

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
Will have to specify:
• Temperature
• Beer Volume
• and probably Carbonation Level
A few test calculations should show if CO2 ratio in the two volumes is independent of carb level or not.
@doug293cz was this in reference to MMP126's post, or were you looking for input #s, or did you mean to link something there?

#### MMP126

##### Lotsa Dude's Thumbs On Here...
@MMP126 Thanks! This is very helpful.

One thing...

Should read ... 12psig + 14.7 = 26.7psia = 3884psf
Right?

Thanks again!
Yep...a 2 and a 4 add up to 6. Haha

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
Yep...a 2 and a 4 add up to 6. Haha
That's a relief. I was afraid I was going to learn something new about "absolute pressure transformations."

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
@doug293cz was this in reference to MMP126's post, or were you looking for input #s, or did you mean to link something there?
Response to OP.

Brew on

#### Gruel

##### Well-Known Member
MMP126 (and OP, and anybody else who cares), the original question wasn't specific about bottles. I think for a bottle you would try to leave as little head space as possible, and then the CO2 in the head space is negligible, or splitting hairs, as you pointed out. But for a half full keg it could matter how much CO2 is in the gas, how much is physically dissolved, and how much dissolved as carbonic acid. I'm looking very much forward to Doug's spreadsheet which will no doubt sort all that out, including the temperature dependence of CO2 solubility.

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
The reason for the original question was so that I could put together a little calculator that answers the question...
"If I'm sugar priming in a keg, how much sugar should I use compared to how much sugar I would have used if bottling, i.e. what percentage?"

The reason I'm building it is that the discussion comes up from time to time in Brewclub meetings and guesstimates range widely, anywhere from "use half as much" to "use the same amount." Testing now.

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
The reason for the original question was so that I could put together a little calculator that answers the question...
"If I'm sugar priming in a keg, how much sugar should I use compared to how much sugar I would have used if bottling, i.e. what percentage?"

The reason I'm building it is that the discussion comes up from time to time in Brewclub meetings and guesstimates range widely, anywhere from "use half as much" to "use the same amount." Testing now.
The keg vs. bottle priming debate is very near and dear to me. I have asked in every forum I have seen the "use half as much sugar in a keg vs. bottling," what is the scientific or empirical basis for this. Never gotten a plausible answer. A full (5 gal in "5" gal keg) keg and a 12 oz bottle have almost the same headspace to beer volume ratio: ~6%. I measured both myself, using weight to determine volume of water.

Brew on

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
I'm looking for a general formula that...

given a sealed container with a specified volume of beer, and a specified volume of headspace

... gives the % of the total CO2 (by weight) that is in the beer and (thus) the % of the total CO2 (by weight) that is in the headspace, assuming equilibrium has been reached.

Anyone? TIA!
Turns out this problem is not as difficult as I originally thought, and does not require an iterative (goal seek) solution. So, let's derive the formula here.

A J deLange gives the volumes of carbonation as a function of CO2 partial pressure and temperature as (see attached PDF, no longer available on-line):

Volumes of carbonation = P [psia] * (0.01821 + 0.090115 * exp(-(T - 32) / 43.11)) - 0.003342​
where:​
P is CO2 partial pressure which equals gauge pressure in psi + atmospheric pressure (14.695 psi at sea level,) if the headspace is 100% CO2​
The parenthetical formula is the temp dependent Henry coefficient​
T is the beer temp in °F​
and 0.003342 is a fudge factor to make the average error vs. the ASBC tables zero​

Converting to °C and dropping the fudge factor (since it is insignificant for our purposes here) leads to this equation:

Volumes of carb = P [psia] * (0.01821 + 0.090115 * exp(- (T / 23.95))​
1 volume of carbonation is equal to 1.977 g/L of CO2, so the mass of CO2 in solution is:

Mass of CO2 in beer = Beer volume [in Liters] * 1.977 [g/L] * P [psia] * (0.01821 + 0.090115 * exp(- (T [°C] / 23.95)))
Now we turn to the mass of CO2 in the headspace.

At 0°C and 1 atmosphere pressure (14.695 psia) CO2 gas has a density of 1.977 g/L (that number should look familiar.) Thus the mass of CO2 in the headspace as a function of temperature and pressure is:

Mass of CO2 in headspace = Headspace volume [in Liters] * 1.977 [g/L] * (P [psia] / 14.965 [psia]) * (273.15° / (T [°C] + 273.15°))​
The ratio of CO2 mass in the beer to CO2 mass in the headspace then becomes:

CO2 Beer / CO2 HS = (Vol Beer/ Vol HS) * 14.965 * (0.01821 + 0.090115 * exp(- (T [°C] / 23.95)) *(T[°C] + 273.15°) / 273.15°​
(hope I didn't make any algebra errors above.)

Edit: No algebra errors, but a couple of typos, which have been corrected in red above.

Brew on

#### Attachments

• 251.2 KB Views: 6
Last edited:

#### day_trippr

##### Bastard-covered bastard with bastard filling
I love this place

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
@doug293cz Thanks! I'm brewing today, but will spend quality time with your post asap. I'm looking forward to seeing how the output compares with the output from @MMP126's formulae.

#### Vale71

##### Well-Known Member
I finally found the time to put together a spreadsheet for OpenCalc that answers VikeMan's question. Just input your vessel volume, your liquid volume and the current temperature and manometer pressure and you'll have values for:

-carbonation level
-gas density in head space and beer
-total CO2

As an added bonus it will automatically tabulate the same values for temperatures between 0°C and 25°C in 1°C increments so that you can see how they would change assuming the vessel is sealed and no further fermentation takes place. This will answer the often-asked question, "Why does my beer become more carbonated in my unitank when I cold-crash?" and if you can measure the above mentioned four paramenters with some accuracy it will also tell you by exactly how much given an initial and a final temperature. Enjoy.

P.S. All units are metric. Deal with it...

#### Attachments

• 15.8 KB Views: 7

#### MMP126

##### Lotsa Dude's Thumbs On Here...
I finally found the time to put together a spreadsheet for OpenCalc that answers VikeMan's question. Just input your vessel volume, your liquid volume and the current temperature and manometer pressure and you'll have values for:

-carbonation level
-gas density in head space and beer
-total CO2

As an added bonus it will automatically tabulate the same values for temperatures between 0°C and 25°C in 1°C increments so that you can see how they would change assuming the vessel is sealed and no further fermentation takes place. This will answer the often-asked question, "Why does my beer become more carbonated in my unitank when I cold-crash?" and if you can measure the above mentioned four paramenters with some accuracy it will also tell you by exactly how much given an initial and a final temperature. Enjoy.

P.S. All units are metric. Deal with it...
Cool! From the look of your sheet, my math worked out too!!

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
@doug293cz I just worked through your formulae. They seem to be in fairly close agreement with @MMP126's. Thanks to you both again!

Next I'll check out @Vale71's sheet. Thanks for that!

#### Jayjay1976

##### Bubblegazer
This thread makes me feel inadequate. You guys truly are the cool kids of HBT.

#### Vale71

##### Well-Known Member
Added a "Pressure" column to the table that lets you see at a glance how pressure in your vessel will change with temperature once the new equilibrium is reached.

#### Attachments

• 16.4 KB Views: 4
OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
Looking more closely, I note that with @MMP126's method, the ratio of CO2 mass between beer and headspace is slightly sensitive to volumes of CO2, where @doug293cz's is not. Peeking ahead at @Vale71's sheet (Thanks!), I see that his is also not.

The answers are all withing spitting distance of each other, but I wonder about the ratio changing (or not). My intuition says it probably shouldn't. Any comments?

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
OK, so I put together a little excel calculator that tries to answer the question of how much priming sugar to use in a keg as compared to bottles, given beer and headspace volume inputs for each, as well as volumes of CO2, temperature at packaging, and ultimate storage temperature. I used @doug293cz's CO2 mass formulae for a good bit of this.

I'm attaching it in case anyone, especially but not limited to @doug293cz, wants to have a look and sanity check. Thanks to @MMP126, @doug293cz, and @Vale71 for all their contributions to the thread!

Note: the Headspace Volume input values in the calculator are completely made up. I need to make some accurate measurements to fill in representative "default" volumes. If it turns out the headspace is pretty much the same in both cases, the calculator itself will have turned out to be a waste of time, but I have learned some things in the process, and there's a thread with some great information in it for posterity.

#### Attachments

• 12.5 KB Views: 3

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
Found a couple of typos in my original analysis. These have been corrected in the post.

Brew on

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
The keg vs. bottle priming debate is very near and dear to me. I have asked in every forum I have seen the "use half as much sugar in a keg vs. bottling," what is the scientific or empirical basis for this. Never gotten a plausible answer. A full (5 gal in "5" gal keg) keg and a 12 oz bottle have almost the same headspace to beer volume ratio: ~6%. I measured both myself, using weight to determine volume of water.
Do you happen to have your keg volume measurements handy? I just measured a bottle, but I don't have a large scale accurate enough to do this with a keg.

FWIW, my standard LHBS "12 oz" bottle measured thus...
Beer (water, with empty headspace): 12.24 fluid ounces
(determined by weighing empty bottle, full bottle, and bottle with headspace displaced/ejected with a closed bottling wand, and doing the math)

I'm betting a lot of folks assume that a typical wand displaced headspace is bigger.

#### doug293cz

##### BIABer, Beer Math Nerd, ePanel Designer, Pilot
Staff member
Mod
Do you happen to have your keg volume measurements handy? I just measured a bottle, but I don't have a large scale accurate enough to do this with a keg.

FWIW, my standard LHBS "12 oz" bottle measured thus...
Beer (water, with empty headspace): 12.24 fluid ounces
(determined by weighing empty bottle, full bottle, and bottle with headspace displaced/ejected with a closed bottling wand, and doing the math)

I'm betting a lot of folks assume that a typical wand displaced headspace is bigger.
Interestingly, I also measured the total volume of a 12 fl oz bottle at 12.81 fl oz.

I measured the total volume of a ball lock corny keg at 5.3 - 5.35 gal.

Brew on

OP

#### VikeMan

##### It ain't all burritos and strippers, my friend.
Interestingly, I also measured the total volume of a 12 fl oz bottle at 12.81 fl oz.

I measured the total volume of a ball lock corny keg at 5.3 - 5.35 gal.
Cool. Thanks Sir!