A double-blind, placebo-controlled trial of nine months duration was carried out to investigate the impact of malaria and its prevention on the educational attainment of school children in a malaria-endemic area in southern Sri Lanka where both Plasmodium falciparum and P. vivax infections are prevalent. A total of 587 children attending grades 1-5 in four schools and resident in the area were randomly allocated to chloroquine (n = 295) and placebo (n = 292) arms. Language and mathematics scores of end-of-term school examinations for 1998 and 1999 and number of days absent and reasons for absenteeism during seven months pre-intervention and nine months of the intervention were recorded. The results indicate that there were no differences in language (95% confidence interval [CI] = 48.44-53.78 in chloroquine group and 50.43-55.81 in placebo group) and mathematics (95% CI = 49.24-54.38 in chloroquine group and 51.12-56.38 in placebo group) scores between the two groups prior to the intervention. During the intervention, the malaria incidence rate decreased by 55% (95% CI = 49-61%) and school absenteeism due to malaria was reduced by 62.5% (95% CI = 57-68%) in children who received chloroquine compared with the placebo group. Post-intervention, children who received chloroquine scored approximately 26% higher in both language (95% CI = 21-31%) and mathematics (95% CI = 23-33%) than children who received placebo. In a multivariate model, educational attainment was significantly associated with taking chloroquine prophylaxis and absenteeism due to malaria (P < 0.001 for both) but not due to health causes other than malaria or non-health causes. Language scores were associated with number of malaria attacks (P < 0.022). Educational attainment was significantly better among children whose compliance to chloroquine prophylaxis was higher (P < 0.001). The data suggest that malarial attacks have an adverse impact on the educational attainment of the school child and prevention of these attacks significantly improves educational attainment of children living in malaria-endemic areas.