Background Previous studies showed that idiopathic inflammatory myopathies (IIM) carried an increased risk of cancers. However, no large-scale study of IIM has been conducted in the Chinese population. Objectives We sought to delineate the association of IIM and various cancer types from a nationwide database in Taiwan. Methods We analysed the published national data from records of National Health Insurance claims. Cases of dermatomyositis (DM) and polymyositis (PM) from 2000 to 2005 and cancers registered in the catastrophic illness profile from 1997 to 2006 were collected. A nationally representative cohort of 1 000 000 enrollees was included for comparison. Results In total, 136 patients (12·8%) among 1059 cases of DM and 46 persons (7·0%) among 661 cases of PM carried internal malignancies. Patients with DM tended to have cancers of nasopharynx, lung and breast. On the other hand, patients with PM tended to have breast, uterine cervix and lung cancers. Compared with the general population, DM gave a 10-fold increased risk for cancers, in which a 66-fold increased risk for nasopharyngeal carcinoma and a 31-fold increased risk for lung cancer were the two most significant. For patients with PM, a 6-fold increased risk for cancer was observed. Juvenile DM had a 16-fold increased risk for haematopoietic or lymphoid malignancy. Two thirds of comorbid malignancies were detected shortly after the diagnoses of IIM, within a mean of 1-2 years. Overall, younger patients with IIM carried the highest risk for malignancies, especially those in their twenties and thirties. Conclusions This is the first large-scale study to report the associated malignancies and the cancer risk of IIM in Taiwan.