Carbon nitride (C2N) based solar cell is getting cynosure in the photovoltaic research community due to their tremendous advantages over other thin-film solar cells such as environmentally friendly material nature and low fabrication cost. In this paper, we theoretically analyzed Zinc Magnesium oxide (Zn1 − xMgxO) as a buffer layer coupled with C2N as an absorber layer to form a p-n junction by using SCAPS- 1D simulation tool. ZMO as an electron transport layer (ETL) utilized with four Mg (x) doped with the concentrations of x = 0.0625, 0.125, 0.1875, and 0.25. After optimizing different layers for the proposed structure, it has been noticed that increasing the thickness of the C2N layer results in the enhancement of efficiency rate. Further, it was observed that the doping density of C2N beyond 1015 cm− 3 degrade the performance of the cell. In addition to this, the optimization of the buffer layer is performed and the optimum performance parameters were achieved at 30 nm. The theoretically modelled structure shows a great enhancement in Open circuit voltage (Voc), Short circuit density (Jsc), Fill factor (FF), and Power conversion efficiency (PCE) with regards to the presented approach. The structure is compared with different kind of other solar cells and obtained parameters shows the higher values of Voc of 1.225 V, Jsc of 18.2572 mA/cm2, FF of 84.96%, and PCE of 19.01%. The recorded results are in good agreement with the standard theoretical studies.