--Lossless block-to-variable length source coding is studied for finite-state, finite-alphabet sources. We aim to minimize the probability that the normalized length of the codeword will exceed a given threshold B, subject to the Kraft inequality. It is shown that the Lempel-Ziv (LZ) algorithm asymptotically attains the optimal performance in the sense just defined, independently of the source and the value of B. For the subclass of unifilar Markov sources, faster convergence to the asymptotic optimum performance can be accomplished by using the minimum description length (MDL) universal code for this subclass. It is demonstrated that these universal codes are also nearly optimal in the sense of minimizing buffer overflow probability, and asymptotically optimal in a competitive sense.Index T e m -Universal noiseless coding, Lempel-Ziv algorithm, length overflow, buffer overflow, finite-state sources, large deviations, competitive optimality.