A baby's gender is determined at the moment of conception. Each human cell contains 23 pairs of chromosomes, with one chromosome from each pair coming from the mother and the other from the father. Out of these 46 chromosomes, only two—one from the sperm and one from the egg—determine the baby's sex. These are called the sex chromosomes. Every egg has an X sex chromosome; a sperm can have either an X or a Y sex chromosome. If the sperm that fertilizes an egg has an X chromosome, the baby is female; if it has a Y chromosome, the baby will be a boy.
Therefore, the father's sperm determines the sex of the baby. The mother always contributes an X chromosome, while the father contributes either an X or a Y.
While gender is determined at conception, it's important to note that gender identity is a complex and individual experience. Many factors, including biological, social, and psychological influences, play a role in shaping an individual's gender identity.