We present a new galaxy scaling relation that predicts the mass fractions of atomic gas, molecular gas and stars as a function of fundamental physical properties such as mass and specific angular momentum. Our scaling relation stretches across two orders of magnitude in mass fraction, and applies to galaxies of any morphological type from Sa to dIrr, thus spanning five orders of magnitude in stellar mass. It has a 1σ scatter of 0.2 dex, a correlation coefficient of 0.8 and a significance level close to 0, which means that the correlation between measured and predicted mass fractions is tight, strong and significant. The new scaling relation is not a best-fitting relation and has no free parameters, but originates from the low galaxy-to-galaxy variance of Q , the mass-weighted average of Toomre's Q stability parameter. This is in contrast to the variance/variation of Q within a galaxy, which is particularly large for atomic gas.