Discontinued medications are frequently not removed from EMR medication lists - a patient safety risk. We developed an algorithm to identify inactive medications using in the text of narrative notes in the EMR. The algorithm was evaluated against manual review of 297 randomly selected notes. One in five notes documented inactive medications. Sensitivity and precision of 87.7% and 80.7%, respectively, on per-note basis and 66.3% and 80.0%, respectively, on per-medication basis. When medication names missing from the dictionary were excluded, the algorithm achieved sensitivity of 91.4%. Using real clinical data, the algorithm identified inactive medications documented in the note but still listed as active on the patients medication list in more than one in ten notes. Documentation of inactive medications is common in narrative provider notes and can be computationally extracted. This technology could be employed in real-time patient care as well as for research and quality of care monitoring.