For some parents, it’s one of the most exciting parts of being pregnant: finding out your baby’s sex. But what, exactly, decides a baby’s sex, and how does it all develop? Here’s your primer to what’s known as fetal sexual differentiation during pregnancy.

When is baby’s sex determined?

Sex is determined at conception by the combination of X and Y sex chromosomes a baby receives from the egg and the sperm. All eggs contain one X chromosome, while sperm contain either an X chromosome or a Y chromosome.

Embryos with XY chromosomes develop male sex organs, while those with XX chromosomes develop female sex organs. That means the sperm determines a baby’s sex!

There are 70 different genes located on the sex chromosomes that define a baby’s sex. Throughout pregnancy, exposure to hormones decided by your baby’s genes affect a baby’s anatomy, physiology and even behavior.

What sex do you start as in the womb?

Up until about week 7 to week 8 of pregnancy, both sexes have what’s known as a “genital ridge” — i.e. an identical preliminary set of genitalia that will eventually differentiate to become either male or female sex organs. 

That means that our sex organs come from the same foundations: The testes in men are equivalent to labia and ovaries in women, and the penis is the equivalent of the clitoris.

When does an embryo become male or female?

Between week 7 and week 12 of pregnancy, the foundations of your baby’s sex organs develop.

Male sex

If it weren’t for the male hormone testosterone, all babies would develop female sex organs. At around week 7, male genitalia begin to develop when the Y chromosome signals for the start of testosterone production. 

At about week 9, a baby boy’s genitals begin the process of becoming male. The genital ridge starts lengthening to form the penis. The penis and clitoris, however, actually remain the same size until about 14 weeks. 

In a baby boy, buds that will become the prostate appear at around 10 weeks, and his urinary system is fully formed by about 14 weeks

Peak concentrations of testosterone in your baby boy’s body are comparable to the amounts found in adult men at around week 16 of pregnancy! Between 16 and 20 weeks, testosterone levels fall until they reach the range found in early puberty by about 24 weeks. 

The testicles will begin descending in week 26, while baby’s penis grows the most during the third trimester.

Female sex

In girls, the ovaries will first appear around weeks 11 to 12 of pregnancy. And by about week 20, a baby girl will have somewhere near 7 million primitive eggs. That eye-popping number will eventually whittle down to about 2 million by the time she’s born. 

At 22 weeks, the vagina opens on the surface of the perineum.

When can you tell the sex of a baby?

At around 18 to 22 weeks of pregnancy, a level 2 anatomy ultrasound can commonly determine whether a baby is male or female by looking for a penis, although technicians do occasionally make the wrong call. They can mistake an umbilical cord for a penis, or sometimes a penis isn’t visible because it’s pushed between the baby’s closed legs.

An ultrasound done at 13 weeks — usually as part of the nuchal translucency screening — can also give a very good clue as to your baby's sex. 

You can find out even earlier at around week 10 of pregnancy if your practitioner recommends noninvasive prenatal testing (NIPT), a screening that analyzes fetal DNA from your baby’s placenta floating in your blood. It can very accurately determine a baby’s sex, though it’s not 100 percent precise. 

The only way to know your baby’s sex for sure before birth is with a more intensive diagnostic test like amniocentesis or chorionic villus sampling (CVS), which look at your baby’s own DNA.

How many people are born intersex (male and female sex characteristics)?

About one in every 1,000 babies are born with noticeably atypical genitalia that’s considered “intersex.” An intersex baby may appear female on the outside with mostly male anatomy in the inside, or with genitals that are mix of male and female types (for example, a girl born with a very large clitoris or a boy with a very small penis). 

Intersexuality can stem from a range of factors, and in some cases the cause is unknown. The most common cause is not having a clear pair of XY or XX chromosomes. Rare disorders such as Turner syndrome, Klinefelter syndrome and androgen insensitivity syndrome are among numerous other causes. NIPT, amniocentesis and CVS can detect common genetic sex chromosome conditions like these in utero.

Some research suggests that more babies — about 1.7 percent — are born with one or more intersex traits, meaning they have hormones, sex chromosomes or genitalia that don’t fit the precise definition of male or female. This uses a much wider definition that incorporates the wide biological diversity seen in the sexes. Most variations are found at birth, but because they can be very subtle, people can discover they’re intersex during puberty (when they develop differently than expected) or even much later in life.  

Asking about your baby’s sex is one of the top queries you’ll get from family and friends throughout your pregnancy. It might be one of the answers you’d most like to know yourself — or maybe you don’t really care! Either way, if you’re only a few weeks into your pregnancy, you can tell them that it’s all the same in that region … at least for now.