Refractive errors, in particular myopia, are a leading cause of morbidity and disability worldwide. Genetic investigation can improve understanding of the molecular mechanisms that underlie abnormal eye development and impaired vision. We conducted a meta-analysis of genome-wide association studies (GWAS) that involved 542,934 European participants and identified 336 novel genetic loci associated with refractive error. Collectively, all associated genetic variants explain 18.4% of heritability and improve the accuracy of myopia prediction (area under the curve (AUC) = 0.75). Our results suggest that refractive error is genetically heterogeneous, driven by genes that participate in the development of every anatomical component of the eye. In addition, our analyses suggest that genetic factors controlling circadian rhythm and pigmentation are also involved in the development of myopia and refractive error. These results may enable the prediction of refractive error and the development of personalized myopia prevention strategies in the future.