This study reports the fabrication of n-type aluminum-and yttrium-codoped zinc oxide (AZOY) on n-Si (AZOY/n-Si) heterojunction solar cells (HJSCs) by using RF magnetron sputtering at various working pressure. AZOY thin films deposited on glass and n-Si substrates at various working pressure were evaluated for optoelectrical properties and performance. At a working pressure of 3 mTorr, the AZOY films showed the lowest resistivity of 8.11×10 -3 Ωcm and visible transmittance (400-800 nm) of 84.64%, and AZOY/n-Si HJSCs achieved a high conversion efficiency of 11.83% (V oc : 498 mV, J sc : 35.89 mAcm −2 , and FF: 0.662). Repeating the optimal working pressure, the n-Si substrate was immersed in ammonium fluoride (NH 4 F) solution to improve the AZOY/n-Si interface state. The fluorine atom had the strongest electron negativity for effective passivation of the silicon dangling bond, and the device's performance was able to further increase conversion efficiency to 12.64% (V oc : 523mV, J sc : 36.79 mAcm −2 , and FF: 0.657). Moreover, NH 4 F solution treatment of the silicon surface can increase the thinness of the SiO x layer from 1.27 to 0.79 nm and reduce the interface state density from 8.59×10 11 to 1.13×10 11 cm 2 .