Sex assignment (also known as gender assignment) is the discernment of an infant's sex, typically made at birth based on an examination of the newborn's external genitalia by a healthcare provider such as a midwife, nurse, or physician. In the vast majority of cases (99.95%), sex is assigned unambiguously at birth. However, in about 1 in 2000 births, the baby's genitals may not clearly indicate male or female, necessitating additional diagnostic steps, and deferring sex assignment.
In most countries the healthcare provider's determination, along with other details of the birth, is by law recorded on an official document and submitted to the government for later issuance of a birth certificate and for other legal purposes.