Conductive zinc oxide (ZnO) films are used extensively as transparent electrodes in thin-film photovoltaic solar cells. Compared with the widely used indium tin oxide (ITO) and tin oxide (SnO2), ZnO has a smaller optical bandgap. ZnO is commonly used as a front contact for copper indium gallium diselenide (CIGS) solar cells, but it forms a small, unfavorable conduction-band offset with the CdS layer. The optical bandgap of ZnO could easily be engineering by alloying with MgO or CdO. In this work, we try to optimize the ZnO for CIGS solar cells. The optical and electrical properties of Zn1-xMgxO:Al films fabricated by co-sputtering were studied. Two targets: ZnO:Al and MgO, were used. The ratio of ZnO/MgO was varied continuously on the 6”x6” glass substrate, and the effects of composition on the properties of the Zn1-xMgxO:Al films were investigated. The carrier concentration and mobility of the Zn1-xMgxO:Al films decreased quickly with increasing Mg content. However, the optical properties of the Zn1-xMgxO:Al films do not vary linearly with Mg content, as reported by most papers. The observed optical bandgap of Zn1-xMgxO:Al films is actually first narrowed, then increased with the Mg content. The shift in optical bandgap from narrow to wide occurs at around a composition of x = 0.07. After the point of x = 0.07, the bandgap width star increase but film sheet resistance already too low. Our result therefore suggests that the alloyed Zn1-xMgxO:Al does not benefit the CIGS solar cell.