Active nematics are influenced by alignment angle singularities called topological defects. The localization of these defects is of major interest for biological applications. The total distortion of alignment angles due to defects is evaluated using Frank free energy, which is one of the criteria used to determine the location and stability of these defects. Previous work used the line integrals of a complex potential associated with the alignments for the energy calculation (Miyazako and Nara 2022 R. Soc. Open Sci . 9 , 211663 (doi: 10.1098/rsos.211663 )), which has a high computational cost. We propose analytical formulae for the free energy in the presence of multiple topological defects in confined geometries. The formulae derived here are an analogue of Kirchhoff–Routh functions in vortex dynamics. The proposed formulae are explicit with respect to the defect locations and conformal maps, which enable the explicit calculation of the energy extrema. The formulae are applied to calculate the locations of defects in so-called doublets and triplets by solving simple polynomial formulae. A stability analysis is also conducted to detect whether defect pairs with charges ± 1 / 2 are stable or unstable in triplet regions. Our numerical results are shown to match the experimental results (Ienaga et al. 2023 Soft Matter 19 , 5016–5028. (doi: 10.1039/d3sm00071k )).