BACKGROUND Contraindications to medicines define circumstances in which the medicines must not be given. Computerized prescribing systems with decision support should display alerts to warn prescribers of contraindications. However, for such systems to be effective, alerts should only be displayed when relevant. OBJECTIVE We set out to construct an algorithm that would classify contraindications according to the data available to a computerized system, and allow them to be displayed in context as far as possible. METHOD We drafted an initial algorithm from first principles, refined it by classifying further datasets, and then tested it on a further set of 95 phrases for contraindications. RESULTS We were able to classify 94 of the 95 phrases; 13 related to age or sex and four related to allergies, but the majority depended on co-morbid conditions. CONCLUSIONS We have constructed a practicable algorithm for classifying alerts to contraindications. The classification used will allow alerts to be displayed when relevant. However, most contraindications relate to co-morbid conditions, and prescribing systems will only be able to display these in context if they have access to relevant clinical data.