The mass density values of optical thin films have been determined by means of a modified floatation method. This method bases on a linear density gradient, which can be produced by stacking mixtures (CH3OH/CHBr3 or C4H10O/CH2J2) with different densities in a vertical glass tube. Due to diffusion processes an exactly linear density gradient is obtained in the tube. The thin layers are now removed from the substrates, crushed and put into the liquid together with calibration substances. After a certain period, the layer particles remain at a certain height in the tube, where the actual density of the liquid is equal to that of the particles. The density of the thin films may then be calculated by a linear regression using the well-known densities of the calibration substances, such as NaCl, KCl, crystalline Si, glass and other. In the present contribution the determination of the mass density of different optical materials is demonstrated. As examples data on so-called `diamondlike' amorphous carbon layers as an IR optical interference coating, CVD diamond layers as an IR window material and amorphous silicon layers as a material for solar cells are presented. The macroscopic mass density values are compared with those obtained from other standard methods, like the normal floatation method, the separate determination of mass and volume of the layer and microscopic densities from EELS measurements. In all cases, a good agreement could be established. Furthermore, the value of the obtained data has been verified by examination of their correlation with other relevant physical properties of optical coatings, such as elementary composition and refractive index. The different effects of microvoids and macrovoids on the refractive index are discussed.