Background: There is evidence of structural brain alterations in major depressive disorder (MDD), but little is known about how these alterations might be affected by age at onset or genetic vulnerability. This study examines whether lifetime episodes of MDD are associated with specific alterations in grey-matter volume, and whether those alterations vary according to sex or serotonin transporter-linked promoter region (5-HTTLPR) genotype (LL, SL or SS). Methods: We used structural MRI to acquire anatomic scans from 610 community-dwelling participants. We derived quantitative regional estimates of grey-matter volume in 16 subregions using FreeSurfer software. We diagnosed MDD according to DSM-IV criteria. We adjusted analyses for age, sex, total brain volume, education level, head injury and comorbidities. Results: Lifetime MDD was associated with a smaller insula, thalamus, ventral diencephalon, pallidum and nucleus accumbens and with a larger pericalcarine region in both men and women. These associations remained after adjustment for false discovery rate. Lifetime MDD was also associated with a smaller caudate nucleus and amygdala in men and with a larger rostral anterior cingulate cortex in women. Late-onset first episodes of MDD (after age 50 years) were associated with a larger rostral anterior cingulate cortex and lingual and pericalcarine regions; early-onset MDD was associated with a smaller ventral diencephalon and nucleus accumbens. Some associations differed according to 5-HTTLPR genotype: the thalamus was smaller in participants with MDD and the LL genotype; pericalcarine and lingual volumes were higher in those with the SL genotype. Limitations: This study was limited by its cross-sectional design. Conclusion: Major depressive disorder was associated with persistent volume reductions in the deep nuclei and insula and with enlargements in visual cortex subregions; alterations varied according to age of onset and genotype.