This disclosure describes systems and methods for compensating for leaks in a ventilation system based on data obtained during periods within a breath in which the patient is neither inhaling nor exhaling. The methods and systems described herein more accurately and quickly identify changes in leakage. This information is then to estimate leakage later in the same breath or in subsequent breaths to calculate a more accurate estimate of instantaneous leakage based on current conditions. The estimated leakage is then used to compensate for the leak flow rates, reduce the patient's work of breathing and increase the patient's comfort (patient-ventilator breath phase transition synchrony).