The speciose insect order Lepidoptera (moths and butterflies) and their closest relatives, Trichoptera (caddis flies), share a female-heterogametic sex chromosome system. Originally a Z/ZZ (female/male) system, it evolved by chromosome rearrangement to a WZ/ZZ (female/male) system in the most species-rich branch of Lepidoptera, a monophyletic group consisting of Ditrysia and Tischeriina, which together comprise more than 98% of all species. Further sporadic rearrangements created multi-sex chromosome systems; sporadic losses of the W changed the system formally back to Z/ZZ in some species. Primary sex determination depends on a Z-counting mechanism in Z/ZZ species, but on a female-determining gene, Fem, in the W chromosome of the silkworm. The molecular mechanism is unknown in both cases. The silkworm shares the last step, dsx, of the hierarchical sex-determining pathway with Drosophila and other insects investigated, but probably not the intermediate steps between the primary signal and dsx. The W chromosome is heterochromatic in most species. It contains few genes and is flooded with interspersed repetitive elements. In interphase nuclei of females it is readily discernible as a heterochromatic body which grows with increasing degree of polyploidy in somatic cells. It is used as a marker for the genetic sex in studies of intersexes and Wolbachia infections. The sex chromosome system is being exploited in economically important species. Special strains have been devised for mass rearing of male-only broods in the silkworm for higher silk production and in pest species for the release of sterile males in pest management programs.