Key messageA stable QTL associated with rice grain type with a large effect value was found in multiple environments, and its candidate genes were verified by genetic transformation.Rice (Oryza sativa L.) grain size is critical to both yield and appearance quality. Therefore, the discovery and identification of rice grain size genes can provide pathways for the cultivation of high-yielding varieties. In the present work, 45,607 SNP markers were used to construct a high-density genetic map of rice recombinant inbred lines, and hence a total of 14 quantitative trait loci (QTLs) were detected based on the phenotypic data of grain weight, grain length and grain width under four different environments. qTGW12a and qGL12 are newly detected QTLs related to grain weight, and are located between 22.43 Mb and 22.45 Mb on chromosome 12. Gene annotation shows that the QTL region contains the LOC_Os12g36660 annotated gene, which encodes the multidrug and toxic compound extrusion (MATE) transporter. Mutations in exons and the splice site were responsible for the changes in grain type and weight. Gene knockout experiments were used to verify these results. Hence, these results provide a basis for the cloning of qTGW12a. This discovery provides new insights for studying the genetic mechanism of rice grain morphology, and reveals a promising gene to ultimately increase rice yield.