A comprehensive mathematical model is proposed to calculate the optimal leg length and cross-section area of TEG unit to maximize the peak output power. The model shows that for a TEG unit, there exists an optimal ratio of leg length and leg cross-section area corresponding to the maximum peak output power with a convective thermal boundary condition, and the optimal leg length and cross-section area can be further calculated based on the optimal ratio. The mathematical model is also validated in this paper, and the corresponding error is within a reasonable range. Moreover, the effects of the leg length and leg area on the peak output power, the peak output power density and the efficiency of TEG unit with different thermal boundary conditions are also discussed. This study will provide guidance for the structure design optimization of TEG unit. (C) 2016 Elsevier Ltd. All rights reserved.