Mammals have XX female: XY male chromosomal sex determination in which a small heterochromatic Y controls male development. Only a few active genes have been identified on the Y, including the testis determining factor SRY and candidate spermatogenesis genes. These genes, as well as several pseudogenes, have close relatives on the X, confirming that the Y was originally homologous to the X, but has been progressively degraded. We used comparative gene mapping of sex chromosomes from the three major groups of extant mammals (eutherians, marsupials and monotremes) to deduce how the X and Y evolved from a pair of autosomes, and how SRY assumed control of sex determination. We found that part of the X, and a corresponding region of the Y chromosome, is shared by all mammals and must be very ancient, but part of the X (and Y) was added quite recently. I propose that a small original X and Y were enlarged by cycles of autosomal addition to one partner, recombination onto the other and continuing attrition of the compound Y. This addition-attrition hypothesis predicts that the pseudoautosomal region of the human X is merely a relic of the last addition, and that the gene content of the pseudoautosomal region may well differ in different mammalian lineages. The only genes which remained active on the conserved or added regions of the Y were those, like SRY, that evolved functions in male sex determination and differentiation distinct from the general functions of their X-linked partners. Although the vertebrate gonadogenesis pathway is highly conserved, its control circuitry has probably changed radically and rapidly in evolution.