We carried out a cross-sectional survey in Shiraz to determine the prevalence of hepatitis C virus (HCV) in 1 444 individuals infected with human immunodeficiency virus (HIV). We also determined the risk factors for this coinfection. Demographic and behavioural data were obtained using a standard questionnaire. The prevalence of HIV–HCV coinfection was 78.4% (95% CI 76.3–80.5). Intravenous drug use (OR = 7.2; 95% CI 4.9–10.6), imprisonment (OR = 6.9; 95% CI 4.6–10.4), tattooing in prison (OR = 2.61; 95% CI 1.4–4.8), tattooing out of prison (OR = 2.0; 95% CI 1.3–3.1) and age (OR = 1.02 with increasing each year of life; 95% CI 1.0–1.04) were significantly associated with HCV–HIV coinfection. Prevalence of HCV–HIV coinfection is high in Shiraz. Intravenous drug use and imprisonment are the main risk factors for this coinfection. Therefore, serious implementation of HIV and HCV testing, education, prevention, care and treatment programmes and evaluation of harm reduction programmes in prisons are very important.