This paper presents a new methodology for optimal design of transformerless photovoltaic (PV) inverters targeting a cost-effective deployment of grid-connected PV systems. The optimal switching frequency as well as the optimal values and types of the PV inverter components is calculated such that the PV inverter LCOE generated during the PV system lifetime period is minimized. The LCOE is also calculated considering the failure rates of the components, which affect the reliability performance and lifetime maintenance cost of the PV inverter. A design example is presented, demonstrating that compared to the nonoptimized PV inverter structures, the PV inverters designed using the proposed optimization methodology exhibit lower total manufacturing and lifetime maintenance cost and inject more energy into the electric-grid and by that minimizing LCOE.