Plays a key role in the replacement of histones to protamine in the elongating spermatids of mammals (PubMed:15163613, PubMed:15189834, PubMed:15083521, PubMed:28366643). In condensing spermatids, loaded onto the nucleosomes, where it promotes the recruitment and processing of protamines, which are responsible for histone eviction (PubMed:28366643). The histone H2AB1-H2BC1/TH2B dimer is required for loading of TNP2 onto chromatin (PubMed:28366643). Loaded onto the nucleosomes of condensing spermatids (PubMed:28366643). Inclusion of the H2AB1-H2BC1/TH2B dimer into chromatin opens the nucleosomes, releasing the nucleosomal DNA ends and allowing the invasion of nucleosomes by transition protein TNP2 (PubMed:28366643). Nuclear import is mediated by IPO4. Nucleolar localization requires the protein to be phosphorylated (By similarity). Appears in elongating/condensing spermatids when histones are still detectable (PubMed:15163613). Coexpressed with H2ab1 during late spermiogenesis (PubMed:28366643). Male mice lacking both Tnp1 and Tnp2 are completely infertile, but protamine alone are capable of histone eviction (PubMed:15163613, PubMed:15189834, PubMed:15083521). A significant proportion of Prm2 remains unprocessed (PubMed:15163613, PubMed:15189834, PubMed:15083521). Chromatin in mature spermatozoa shows defects in density (PubMed:15189834, PubMed:15083521). Belongs to the nuclear transition protein 2 family.