Objective: This paper defines a method for optimizing the breath delineation algorithms used in electrical impedance tomography (EIT). In lung EIT the identification of the breath phases is central for generating tidal impedance variation images, subsequent data analysis and clinical evaluation. The optimisation of these algorithms is particularly important in neonatal care since the existing breath detectors developed for adults may give insufficient reliability in neonates due to their very irregular breathing pattern. Approach: Our approach is generic in the sense that it relies on the definition of a gold standard and the associated definition of detector sensitivity and specificity, an optimisation criterion and a set of detector parameters to be investigated. The gold standard has been defined by 11 clinicians with previous experience with EIT and the performance of our approach is described and validated using a neonatal EIT dataset acquired within the EU-funded CRADL project. Main results: Three different algorithms are proposed that improve the breath detector performance by adding conditions on (1) maximum tidal breath rate obtained from zero-crossings of the EIT breathing signal, (2) minimum tidal impedance amplitude and (3) minimum tidal breath rate obtained from time-frequency analysis. As a baseline a zero-crossing algorithm has been used with some default parameters based on the Swisstom EIT device. Significance: Based on the gold standard, the most crucial parameters of the proposed algorithms are optimised by using a simple exhaustive search and a weighted metric defined in connection with the receiver operating characterics. This provides a practical way to achieve any desirable trade-off between the sensitivity and the specificity of the detectors.