We study the absorption in a silicon heterojunction solar cell. After determining the texture and film properties of the cell from experimental data, we apply ray tracing to quantify the absorption as a function of wavelength and depth in each of the cell's many layers. By comparing the results to the measured external quantum efficiency, we determine the collection efficiency of the front intrinsic a-Si:H film to be 0.35. We then asses the optimal thickness topt of the front and rear ITO layers with and without encapsulation under the AM1.5g spectrum, finding that after encapsulation (i) topt of the front ITO decreases from 70 nm to zero, (ii) topt of the rear ITO remains at about 100 nm, and (iii) the sensitivity of absorption and reflection to the front ITO thickness decreases. We also conclude that the collection current could be increased by up to 2.7 mA/cm 2 by reducing the absorptance of the ITO and using thinner a-Si films, or by 1.3 mA/cm 2 by increasing the collection efficiency of the front a-Si:H layers. The described approach is applicable to any solar cell containing thin-film stacks.