Transformer leakage inductance and line impedance cause the actual Power Grid exist impendence which easily lead to deterioration of stability, even unstable when output impedance of grid-connected inverter mismatch the impendence of the power grid. When analysis the system stability using impedance stability criterion, researching work on characteristic of closed-loop output impedance of the grid-connected inverter is critical. Firstly, the closed-loop output impedance model is established in stationary coordinate system, and the stability mechanism were studied when the power grid exist impedance. For the delay of PWM modulation and digital control system equivalent delay impacting on the closed-loop output impedance, this paper presents a method for optimizing the output impedance to increase the magnitude of the closed-loop output impedance and improve the stability of the system. Using the optimized impendence proposed in this paper, the stability of grid-connected inverter is analyzed and experimental validated in the case of RLC type grid impedance. Experimental results validate the correctness and effectiveness of proposed method..