Context. Solar and extrasolar comets and extrasolar planets are the subject of numerous studies in order to determine their chemical composition and internal structure. In the case of planetesimals, their compositions are important as they govern in part the composition of future planets. Aims. The present works aims at determining the chemical composition of icy planetesimals, believed to be similar to present day comets, formed in stellar systems of solar chemical composition. The main objective of this work is to provide valuable theoretical data on chemical composition for models of planetesimals and comets, and models of planet formation and evolution. Methods. We have developed a model that calculates the composition of ices formed during the cooling of the stellar nebula. Coupled with a model of refractory element formation, it allows us to determine the chemical composition and mass ratio of ices to rocks in icy planetesimals throughout in the protoplanetary disc. Results. We provide relationships for ice line positions (for different volatile species) in the disc, and chemical compositions and mass ratios of ice relative to rock for icy planetesimals in stellar systems of solar chemical composition. From an initial homogeneous composition of the nebula, a wide variety of chemical compositions of planetesimals were produced as a function of the mass of the disc and distance to the star. Ices incorporated in planetesimals are mainly composed of H 2 O, CO, CO 2 , CH 3 OH, and NH 3 . The ice/rock mass ratio is equal to 1 ± 0.5 in icy planetesimals following assumptions. This last value is in good agreement with observations of solar system comets, but remains lower than usual assumptions made in planet formation models, taking this ratio to be of 2-3.