Perovskites as semiconductors are of profound interest and arguably, the investigation on the distinctive perovskite composition is paramount to fabricate efficient devices and solar cells. The role of anion and cations and their impact on optoelectronic and photovoltaic properties is probed. A machine learning (ML) approach to predict the bandgap and power conversion efficiency (PCE) using eight different perovskites compositions is reported. The predicted solar cell parameters validate the experimental data. The adopted Random forest model presents a good match with high R-2 scores of >0.99 and >0.82 for predicted absorption and J-V datasets, respectively, and show minimal error rates with a precise prediction of bandgap and PCEs. The results suggest that the ML technique is an innovative approach to aid the preparation of the perovskite and can accelerate the commercial aspects of perovskite solar cells without fabricating working devices and minimize the fabrication steps and save cost.