We describe an algorithm for rapid real-time detection, quantitation, localization of seizures, and prediction of their clinical onset. Advanced digital signal processing techniques used in time-frequency localization, image processing, and identification of time-varying stochastic systems were used to develop the algorithm, which operates in generic or adaptable "modes." The "generic mode" was tested on (a) 125 partial seizures (each contained in a 10-min segment) involving the mesial temporal regions and recorded using depth electrodes from 16 subjects, and (b) 205 ten-minute segments of randomly selected interictal (nonseizure) data. The performance of the algorithm was compared with expert visual analysis, the current "gold standard." The generic algorithm achieved perfect sensitivity and specificity (no false-positive and no false-negative detections) over the entire data set. Seizure intensity, a novel measure that seems clinically relevant, ranged between 35.7 and 6129. Detection was sufficiently rapid to allow prediction of clinical onset in 92% of seizures by a mean of 15.5 s. This algorithm, which was implemented with a personal computer, represents a definitive step toward rapid and accurate detection and prediction of seizures. It may also enable development of intelligent devices for automated seizure warning and treatment and stimulate new study of the dynamics of seizures and of the epileptic brain.