This study investigated the correlation between the residual stress and microstructural factors, such as the thermal expansion mismatch of Al and Si, Si solid solubility, and dislocation density, in Al-12Si alloys. As-built Al-12Si alloys produced via selective laser melting were solution heat treated at 540 degrees C for 1, 7, and 26 h, followed by water quenching. Here, the as-built Al-12Si alloy exhibited the highest residual stress in the Al matrix owing to the large temperature gradient and high Si solid solubility. After heat treatment for 1 h, the residual stress abruptly decreased to - 4 +/- 2 MPa. With an increase in the solution time, the residual stress improved to - 15 +/- 2 and - 21 +/- 2 MPa for Al-12Si alloys heat treated for 7 and 26 h, respectively, owing to the further Al matrix expansion, Si solid solubility, and dislocation density. Additionally, the relationship between the residual stress, microstructure, and coefficient of thermal expansion was experimentally elucidated. This study's findings reveal the residual stress behavior of Al-12Si alloys by collectively considering the microscale factors and are expected to be relevant for future research on improving the prediction accuracy of residual stresses of Al-Si alloys.