Females have an XX pair of sex chromosomes, and males, an XY pair. A baby’s gender is determined by the sperm cell that fertilizes a woman’s egg. Sperm carry one sex chromosome, either a Y (male) or X (female).
To better understand, let’s look at how sperm develop. A human sperm results from the division of a cell containing 46 chromosome pairs, including one pair of sex chromosomes: one X and one Y. So exactly half of a man’s sperm have Y (male) chromosomes and half X (female) chromosomes. Other than the two sex chromosomes, the 22 other chromosome pairs that the sperm carries are genetically identical
The sperm also carries half of an embryo’s DNA; the egg holds the other half. When the two combine, following sexual intercourse or fertilization in a lab (IVF), the resulting embryo will have a full 46 chromosome pairs. One pair determines the gender, and the other 22 pairs determine everything else about the baby, including eye color, height and body type.
If an egg is fertilized by an X-bearing sperm, the resulting embryo will have two X chromosomes (XX), and will grow into a baby girl. If a Y-bearing sperm fertilizes the egg, the embryo will have XY chromosomes, a boy. (Except in the rare case of testicular feminization.) Since men’s sperm carry both male and female chromosomes (Y & X) in 50:50 proportion, and women’s eggs carry only one female chromosome (only X, because her sex chromosomes are XX), the man’s sperm holds the key to a baby’s gender.