Stevens-Johnson syndrome (SJS) and toxic epidermal necrolysis (TEN), severe drug reactions, are often misdiagnosed due to their rarity and lack of information on differential diagnosis. The objective of the study was to develop an electronic medical record (EMR)-based algorithm to identify patients with SJS/TEN for future application in database studies. From the EMRs of a university hospital, two dermatologists identified all 13 patients with SJS/TEN seen at the Department of Dermatology as the case group. Another 1472 patients who visited the Department of Dermatology were identified using the ICD-10 codes for diseases requiring differentiation from SJS/TEN. One hundred of these patients were then randomly sampled as controls. Based on clinical guidelines for SJS/TEN and the experience of the dermatologists, we tested 128 algorithms based on the use of ICD-10 codes, clinical courses for SJS/TEN, medical encounters for mucocutaneous lesions from SJS/TEN, and items to exclude paraneoplastic pemphigus. The sensitivity, specificity, positive predictive value (PPV), negative predictive value (NPV), and diagnostic odds ratio (DOR) of each algorithm were calculated, and the optimal algorithm was defined as that with high PPV and maximal sensitivity and specificity. One algorithm, consisting of a combination of clinical course for SJS/TEN, medical encounters for mucocutaneous lesions from SJS/TEN, and items to exclude paraneoplastic pemphigus, but not ICD-10 codes, showed a sensitivity of 76.9%, specificity of 99.0%, PPV of 40.5%, NPV of 99.8%, and DOR of 330.00. We developed a potentially optimized algorithm for identifying SJS/TEN based on clinical practice records. The almost perfect specificity of this algorithm will prevent bias in estimating relative risks of SJS/TEN in database studies. Considering the small sample size, this algorithm should be further tested in different settings.