In Medium Voltage grid-connected high power converters, due to switching frequency limitations, bulky and expensive passive filters are needed in order to limit the harmonic content in the point of common coupling (PCC). In this paper, a design procedure that optimizes the cost and volume of a LCL filter is proposed and experimentally validated, taking into account the effect of current and voltage harmonics and fulfilling the stringent grid codes limits. The proposed design methodology is based on an optimization function that finds the optimal filter element values minimizing the total filter size and cost automatically.