Heterochromatin is a key architectural feature of eukaryotic chromosomes, which endows particular genomic domains with specific functional properties. The capacity of heterochromatin to restrain the activity of mobile elements, isolate DNA repair in repetitive regions and ensure accurate chromosome segregation is crucial for maintaining genomic stability. Nucleosomes at heterochromatin regions display histone post-translational modifications that contribute to developmental regulation by restricting lineage-specific gene expression. The mechanisms of heterochromatin establishment and of heterochromatin maintenance are separable and involve the ability of sequence-specific factors bound to nascent transcripts to recruit chromatin-modifying enzymes. Heterochromatin can spread along the chromatin from nucleation sites. The propensity of heterochromatin to promote its own spreading and inheritance is counteracted by inhibitory factors. Because of its importance for chromosome function, heterochromatin has key roles in the pathogenesis of various human diseases. In this Review, we discuss conserved principles of heterochromatin formation and function using selected examples from studies of a range of eukaryotes, from yeast to human, with an emphasis on insights obtained from unicellular model organisms.