Iron deficiency is the most common nutritional deficiency in the world, but iron supplementation can increase risk of opportunistic infections, especially in children living with HIV. We aimed to assess the effect of supplemental iron on haemoglobin concentration in children living with HIV and mild-to-moderate anaemia in Uganda. We did a double-blind, randomised, placebo-controlled trial of iron supplementation in children aged 6 months to 12 years living with HIV at two sites (ie, Kampala and Fort Portal, Uganda). Inclusion criteria were confirmed diagnosis of HIV and stable treatment with antiretroviral therapy for at least 6 months. Exclusion criteria were already taking iron supplementation, acute illness, current opportunistic infection, fever, known sickle cell disease, severe undernutrition, or any chronic illness requiring medical attention. Children were randomly assigned (1:1) via simple randomisation to an 84-day course of either ferrous sulphate or identical placebo tablets once per day. Randomisation codes were computer-generated and stratified by age (ie, 6-23 months or 24 months and older) by the Toronto Institute of Pharmaceutical Technology, the tablet manufacturer. Participants and all individuals giving the interventions, assessing outcomes, and analysing data were masked to group assignment. Children aged 6-23 months received tablets of 12·5 mg ferrous sulphate or identical placebo; children aged 24 months or older received tablets of 30·0 mg ferrous sulphate or identical placebo. Caregivers were instructed to give the supplement after a meal, preferably after an evening meal. The primary outcome was mean haemoglobin concentration at day 84. All analyses were intention to treat. This trial is registered at ClinicalTrials.gov (NCT03596996). Between May 5, 2018, and Nov 6, 2019, 973 children living with HIV were screened, of whom 200 (20%) met all inclusion criteria and were enrolled. 102 (51%) were randomly assigned to receive iron and 98 (49%) to receive placebo. In the iron group, 57 (56%) of 102 children were male and 45 (44%) were female. In the placebo group, 44 (45%) of 98 children were male and 54 (55%) were female. Iron supplementation was associated with improvement in haemoglobin in unadjusted analysis (p=0·029), but not adjusted analysis (p=0·10), and with improvement in ferritin and hepcidin in both adjusted (p=0·0046; p=0·0079) and unadjusted (p<0·0001; p<0·0001) analyses at day 84. There were four hospital admissions, all for children in the iron group; none were fatal: two children were admitted to hospital with pneumonia, one with severe malaria, and one with hepatitis. Frequency of admissions was not significantly different between groups (p=0·12). Iron could have haematological benefit and improve iron status in children living with HIV in Uganda. Future studies powered for morbidity outcomes with longer follow-up are needed, as are those that evaluate the effects of iron supplementation on neurocognitive outcomes. Minnesota Masonic Charities, the Department of Pediatrics at the University of Minnesota, the Hennepin Healthcare Research Institute, and the US National Institutes of Health.