In mammals, male sex determination, as well as spermatogenesis, is controlled by genes on the Y chromosome. Evolutionary comparisons may be used to detect and test candidate genes for these functions, under the hypothesis that the rapid evolution of the mammalian Y chromosome causes it to contain few genes other than those with a critical function in male reproduction. Comparisons of the gene content of sex chromosomes from the three major groups of extant mammals (placentals, marsupials, and monotremes) show that part of the X chromosome, and a corresponding region of the Y, is shared by all mammals and must be very ancient, but part was added relatively recently. Evolution of the mammalian Y took place in several cycles of addition and attrition, as autosomal regions were added to the pseudoautosomal region of one sex chromosome, recombined onto the other, and degraded on the Y. This explains why most genes and pseudogenes on the Y chromosome have relatives on the X. The gene SRY itself is apparently no exception, being closely related to the highly conserved X-linked gene SOX3. Comparisons of SRY/SOX base sequence and gene location in the three groups of mammals suggest that SRY evolved from SOX3 relatively recently by mutation and loss of all sequences outside the HMG box. It is suggested here that, rather than acting as a transcriptional activator, the SRY gene acts to inhibit its paralogue SOX3, which in turn inhibits an ancient autosomal sex-determining gene SOX9.