Abstract Global warming becomes a serious issue in the swine industries of most countries. Sow reproduction suffers the brunt of heat stress problems in tropical and subtropical zones, such as in Taiwan. Litter traits, total number born (TNB) and number born alive (NBA), are essential for sow stability and farm economics. However, these traits are influenced by management, facilities, and environmental conditions. Adjustments to management practices and facilities must be considered environmental conditions, including temperature and relative humidity, particularly in Taiwan under oceanic climates. Such specific climate with high temperature and relative humidity caused heat stress for sows around Taiwan over six months in a year. Therefore, the impact of heat stress at different stages of pregnancy in sows had been analyzed using the best linear unbiased prediction model with heterogeneous residuals. A total of 11,074 records for TNB and NBA from 3,080 Landrace sows were collected from two farms between 2008 and 2021. Simultaneously, weather data were obtained from those weather stations closest to the farms. Sows from mating to farrowing, about four months, had been classified into cool (C) or hot (H) climate condition in each month based on temperature-humidity index equals 70. Hence, there were eight combinations (CCCC, CCCH, CCHH, CHHH, HHHH, HHHC, HHCC, HCCC) of the climate effect in this study. The results of climate effect showed that there was not significant difference among the groups of CCCC, CCCH, CCHH, and CHHH in TNB and NBA, while no significant difference (P > 0.05) was found among the groups of HHHH, HHHC, HHCC, and HCCC in both traits. However, the climate effects of CCCH, CCHH, and CHHH were greater (P < 0.05) than those of HHHC, HHCC, and HCCC in TNB. The climate effects of CCCH and CCHH were greater than those of HHHH, HHHC, HHCC, and HCCC in NBA (P < 0.05). These fluctuations generally indicated when sows experience heat stress on mating and early stage of pregnancy (HHHH, HHHC, HHCC, HCCC), could decrease litter sizes. In the heterogeneous residual variances, the groups of CCCC, CCCH, CCHH, and CHHH were less than the groups of HHHH, HHHC, and HHCC in TNB, significantly, while the groups of CCCC, CCCH, and CHHH were less than the groups of HHHH, HHHC, and HHCC in NBA (P < 0.05). The greatest estimated residual variances were shown in HHCC in both TNB and NBA. These changing of trends indicated high heterogeneous residual variance was discovered when heat stress happened during mating and early pregnancy of sows (HHHH, HHHC, HHCC). In conclusion, heat stress at mating and early stage of sow pregnancy decreased the average and increased the residual variances of TNB and NBA.