Sleep onset latency (SOL) is frequently defined as the time between lights-out and the first epoch of sleep stage 2. In practice, SOL can be quantified easily on the basis of visual examination. We have developed a computer algorithm allowing an automatic estimation of this parameter. The agreement between both strategies, visual and computer analysis, was tested using data from a pharmacological sleep study with 16 elderly insomniacs, which was aimed at comparing the effects of lormetazepam and zopiclone on polysomnography. A high correlation was found between the visual and the computer-based determination of SOL. Drug-related differences in SOL could be shown with both approaches.