Thin film solar cells based on the CdS/CdTe heterojunction, where the CdTe polycrystalline layer is deposited making use of the close-spaced sublimation (CSS) technique have attained a very good level of conversion efficiency in recent times. Despite this apparently consolidated situation the debate on the formation of the CdS/CdTe heterojunction is still open indicating that a certain margin of improvement is still possible. In particular, the conclusion that a CdSxTe1-x alloy is formed at the CdS/CdTe interface due to interdiffusion that takes place during fabrication. The extent of the interdiffusion and the value of x depend on many factors such as deposition temperature, gas pressure and geometrical parameters. The situation is even more complicated because while the deposition is in progress. the ratio between the number of Te and the Cd atoms which are reaching the target is invariably greater than one. To shed some light on these issues it is mandatory to know at least the exact Te/Cd ratio as a function of the deposition parameters. To this end we carried out a Monte Carlo computer simulation of the CdTe deposition in our CSS equipment. The computer code was implemented starting from very simple hypotheses simulating the deposition in perfect gas at constant temperature. Subsequently, we added more physical reality including temperature gradient between source and target. The code was then finally optimized introducing the usual null-event method which confirmed the consistency of our results. (C) 2000 Elsevier Science S.A. All rights reserved.