Accurate and simple formulas are presented for effective length in determining the resonant frequency of C and H shaped compact microstrip antennas (CMAs) operating on UHF band. For this purpose, 144 C-shaped CMAs and 216 H-shaped CMAs having different physical dimensions and various relative dielectric constants were simulated by packaged software called XFDTD based on finite difference time domain (FDTD) method. The physical and electrical parameters of the antennas and their respective resonant frequency values were given as inputs to artificial bee colony (ABC) algorithm to determine unknown coefficients of the effective length expression which provides the best fit to the resonant frequency. The resonant frequency results of the effective length expressions were compared with the different measurement, simulation and calculation results published earlier in the literature. It was shown that our results are in very good agreement with the simulated and measured results as compared to those of calculated by the other suggestions reported elsewhere. Moreover, C and H shaped CMAs were fabricated in this work and then the accuracy and validity of proposed expressions were tested and verified. Major benefit of the formulation proposed here is that it provides accurate results without necessitating any other calculations.