In microgrids (MG) with a high penetration of renewable energy sources (RES) power converters are used to regulate the produced energy to a single voltage and frequency reference value across the MG. Adequate incorporation of an LC filter at the output of power electronic devices allows the attenuation of harmful harmonics that can be introduced to the MGs energy bus. By traditional methods, LC filter values can be calculated by means of the power rating, switching frequency, cutoff frequency, and using the bode frequency domain. Nonetheless, in the transition from a connected to an autonomous MG operation, the calculated LC filter can lead to high harmonic injection. As a result, a tuning methodology capable of obtaining the right set of parameters for the LC filter for a transition event can improve the performance of the MG. This work optimizes the LC output parameters with respect to the size of the filter components, the IEEE Std 519-2014, and bandwidth of the filter, within a bounded region of values subjected to performance conditions such as voltage output, and the produced total harmonic distortion (THD) measurements during the transition from a connected to an autonomous operation. In a case study, genetic algorithm optimization is used to obtain the LC filter parameters and compared to a conventional arithmetic methodology to obtain the values of the filter. The optimization results in a set of values that lead to a higher harmonic attenuation after the transition rather than a conventional method using the switching frequency as the main design factor.