We determined the prevalence of microsporidia Enterocytozoon (Ent.) bieneusi and Encephalitozoon (E.) intestinalis infection in patients with chronic diarrhoea and hepatocellular carcinoma (HCC). A total of 330 stool samples were examined from 171 (52%) patients with chronic diarrhoea, 18 (5%) with HCC while 141 (43%) were controls. Stool microscopy, polymerase chain reaction (PCR) with species-specific primers for Ent. bieneusi and E. intestinalis and sequencing were carried out. Microsporidia were found by trichrome staining in 11/330 (3%) and E. intestinalis by PCR in 13/330 (4%) while Ent. bieneusi was not detected. PCR for E. intestinalis was positive in 8/171 (5%) stool samples from patients with chronic diarrhoea, 2/141 (1·4%) samples from healthy controls and in 3/18 (17%) samples from patients with HCC. In the chronic diarrhoea group, E. intestinalis was positive in 4/171 (2·3%) (P=0·69) stool samples compared to 2/18 (11%) (P=0·06) in the HCC group and 2/141 (1·4%) from healthy controls. E. intestinalis infection was significantly associated with chronic diarrhoea and HCC in these patients who were negative for HIV. Stool examination with trichrome or species-specific PCR for microsporidia may help establish the cause of chronic diarrhoea.