Kinetic theory and acoustic measurements have proven that the bulk viscosity associated with the expansion or compression effect cannot be ignored in compressible fluids except for monatomic gases. A new theoretical formula for the bulk viscosity coefficient (BVC) ζ is derived by the continuum medium methodology, which provides a further understanding of the bulk viscosity, i.e. ζ is equal to the product of the bulk modulus K and the relaxation time τ (ζ = Kτ ). The continuum and kinetic theories present consistent results from macro-and microperspectives respectively, only differing in terms of a coefficient. The theoretical predictions of the BVC in diatomic molecules, such as N 2 , O 2 and CO, show good agreement with the experimental data over a wide range of temperature. In addition, the vibrational contributions to ζ are controlled by a rapid exponential decrease at high temperatures, while at low temperatures a slow linear increase proceeds for the rotational cases. The relaxation time τ , collision number Z, BVC ζ and ratio of bulk-to-shear viscosities ζ /µ in the vibrational mode are found to be several orders of magnitude larger than those in the rotational mode.