When Is the Sex of a Fetus Determined?

The genetic sex of a fetus is locked in at the moment of conception, when a sperm carrying either an X or a Y chromosome fuses with the egg. But that single chromosomal event is only the starting gun for a developmental process that unfolds over weeks and months, involving gene switches, hormone cascades, and physical reshaping of tissue. The gap between “determined” and “visible” is surprisingly wide, and the biology in between is where most of the interesting questions live.

What Happens at Conception

Every egg carries an X chromosome. Every sperm carries either an X or a Y. When a Y-bearing sperm fertilizes the egg, the result is an XY embryo; when an X-bearing sperm does, the result is XX. That chromosomal combination is fixed from the first cell division onward and cannot change.

The two types of sperm are nearly identical. The only meaningful difference between X-bearing and Y-bearing sperm is their DNA content, since the Y chromosome is substantially smaller than the X.1Frontiers in Cell and Developmental Biology. New Biological Insights on X and Y Chromosome-Bearing Spermatozoa Despite centuries of folk beliefs about timing intercourse, diet, or sexual position to influence whether you conceive a boy or a girl, the selection is essentially random. A large analysis of human sex ratios estimated the proportion of males at conception to be roughly 0.5, contradicting the long-standing claim that more males are conceived than females.2PubMed Central. The human sex ratio from conception to birth

The First Six Weeks Are Identical

For the first several weeks after conception, XX and XY embryos look the same internally. Both develop a pair of structures called bipotential gonads, which have the capacity to become either testes or ovaries. A recent single-cell atlas of human fetal gonads between five and twelve weeks after conception identified a shared population of progenitor cells in both sexes, derived from the same tissue lining, capable of committing to either a male or a female fate.3Cell Press (Developmental Cell). Single-cell exploration of gonadal somatic cell lineage specification during human sex determination Those cells don’t begin committing to sex-specific roles until around week six after conception.

This indifferent stage is a genuine fork in the road, not just a passive waiting period. The same tissue contains both potential outcomes, and it takes an active molecular signal to push development one way rather than the other.

The Gene That Tips the Balance

In XY embryos, the critical trigger is a gene called SRY, located on the Y chromosome. SRY stands for “sex-determining region Y,” and in mammals it acts as the master switch for testicular development.4PubMed Central. Regulation of male sex determination: genital ridge formation and Sry activation in mice When SRY activates in the bipotential gonad, it sets off a chain of gene activity that pushes the gonad to become a testis. The newly formed testes then begin producing two key hormones: testosterone and a protein called anti-Müllerian hormone. Testosterone drives the development of male internal reproductive structures, while anti-Müllerian hormone causes the female-pathway ducts to break down.

In XX embryos, the absence of SRY means the gonad follows the ovarian pathway instead. This is not simply a default or passive process. Ovarian development requires its own active signaling, including a pathway involving a secreted protein called RSPO1 and a signaling system known as WNT/β-catenin.5PubMed Central. RSPO1/β-catenin signaling pathway regulates oogonia differentiation and entry into meiosis in the mouse fetal ovary The old textbook framing that female development is what happens “by default” when the male pathway fails to kick in is outdated. Both paths require active genetic programs.

When the External Anatomy Takes Shape

Even after the internal gonads have committed to a male or female path around week six, the external genitalia remain indistinguishable for several more weeks. Detailed anatomical studies of human fetal specimens show that male and female external genitalia start out at the same indifferent stage at about eight to nine weeks of gestation. In males, a tubular urethra forms within the developing penis, and a circumferential foreskin develops. In females, the urethra does not form within the clitoral body, and the prepuce remains only on the dorsal side.6PubMed Central. Macroscopic Whole-Mounts of the Developing Human Fetal Urogenital-Genital Tract: Indifferent Stage to Male and Female Differentiation

The physical differences become progressively more obvious between weeks nine and seventeen, but the external genitalia are not fully formed until roughly seventeen to eighteen weeks of gestation. The male penis grows to about five times its initial length between eight and twenty-two weeks.6PubMed Central. Macroscopic Whole-Mounts of the Developing Human Fetal Urogenital-Genital Tract: Indifferent Stage to Male and Female Differentiation This gradual development is the reason ultrasound can’t reliably tell you your baby’s sex until well into the pregnancy.

When Can You Find Out by Ultrasound

Most parents learn the sex of their baby from an ultrasound, typically at the mid-pregnancy anatomy scan around eighteen to twenty weeks. At that point, accuracy is very high. But the question of how early ultrasound can distinguish sex is worth unpacking, because the answer depends on how much uncertainty you’re willing to accept.

A systematic review and meta-analysis of prenatal ultrasound studies found that the average accuracy of first-trimester sex identification was about 85%, with sensitivity jumping from around 69% at eleven weeks to 89% at twelve weeks and 96% at thirteen weeks.7PubMed Central. Effectiveness of prenatal ultrasound in fetal sex identification: a systematic review and meta-analysis By the second and third trimesters, accuracy climbed to a median of 99%.

Individual studies paint a similar picture with some interesting details. One study examining ultrasound at eleven to twelve weeks found a positive predictive value of about 88% for males and 97% for females, meaning early scans were more reliable at confirming a girl than a boy.8PubMed Central. The ultrasound identification of fetal gender at the gestational age of 11–12 weeks Another study found that before twelve weeks, fewer than half of predictions were correct in some subgroups. Between twelve and thirteen weeks, accuracy rose to about 77%, and by fourteen to sixteen weeks, all examined fetuses were correctly identified.9PubMed Central. Accuracy of sonographic fetal gender determination: predictions made by sonographers during routine obstetric ultrasound scans

Practical factors matter here too. Higher maternal body mass and an uncooperative fetal position are the most common reasons sonographers can’t make a call, even late in pregnancy. If your sonographer says they can’t tell at your twelve-week scan, it doesn’t mean anything is wrong. It usually just means the baby wasn’t in a position to show the relevant anatomy clearly.

Cell-Free DNA Blood Tests

A newer and increasingly popular option is non-invasive prenatal testing, which analyzes fragments of fetal DNA circulating in the mother’s bloodstream. These tests can detect Y-chromosome sequences: if they’re present, the fetus is male; if absent, the fetus is female.

A meta-analysis of studies using cell-free DNA for fetal sex determination found an overall sensitivity of about 97% and specificity of about 99%, with performance remaining reliably high regardless of whether the test was done in the first, second, or third trimester.10PubMed Central. Non-invasive prenatal diagnostic test accuracy for fetal sex using cell-free DNA a review and meta-analysis That’s remarkably good for a blood draw.

How early can it work? One study found that SRY sequences (from the Y chromosome) could be detected in maternal blood as early as five weeks and two days of gestation, though reliability that early was limited. By seven weeks, about 80% of male pregnancies were correctly identified, and by ten weeks, all male pregnancies in the study were correctly detected.11PubMed. Earliest gestational age for fetal sexing in cell-free maternal plasma None of the female pregnancies produced a false positive. Commercial at-home “early gender” blood tests marketed to expecting parents are based on this same principle, though their real-world accuracy can vary depending on the lab and how early the sample is collected.

For clinical purposes, cell-free DNA testing is particularly valuable in families at risk for sex-linked genetic conditions such as hemophilia or Duchenne muscular dystrophy, where knowing the fetal sex early can guide further diagnostic decisions.

Invasive Diagnostic Methods

Amniocentesis and chorionic villus sampling (CVS) provide a direct look at fetal chromosomes and are effectively 100% accurate for determining chromosomal sex. CVS can be performed as early as ten to twelve weeks, and amniocentesis typically from about fifteen weeks onward.12PubMed Central. State-wide increase in prenatal diagnosis of klinefelter syndrome on amniocentesis and chorionic villus sampling: Impact of non-invasive prenatal testing for sex chromosome conditions Because both carry a small risk of miscarriage, they are generally reserved for pregnancies with specific medical indications rather than simple curiosity about sex.

Preimplantation genetic testing, used during in-vitro fertilization, can determine chromosomal sex even earlier, before an embryo is transferred to the uterus. This technology was originally developed in the early 1990s to prevent the transfer of embryos carrying sex-linked genetic diseases. Initially, the approach was simply to identify and transfer only female embryos in families at risk for X-linked conditions.13The Lancet. Preimplantation genetic diagnosis Today, more precise genetic analysis can identify whether an embryo actually carries the disease gene, rather than relying on sex alone as a proxy.

When Chromosomes and Anatomy Don’t Match

The standard narrative of sex determination presents a clean, linear path: XY leads to testes, testes lead to testosterone, testosterone leads to male anatomy. But biology is messier than that, and several well-documented conditions illustrate how different steps in the process can diverge.

In complete androgen insensitivity syndrome, an individual has XY chromosomes and functioning testes that produce testosterone, but the body’s androgen receptors don’t respond to it. The result is that the person develops completely female external genitalia and, at puberty, breast development, despite being genetically male.14Endocrine Journal. Mismatch between fetal sexing and birth phenotype: a case of complete androgen insensitivity syndrome Partial forms of the condition produce a range of outcomes between fully male and fully female external anatomy, depending on how much receptor function remains.15Archives of Medical Science. The challenges of androgen insensitivity syndrome A prenatal blood test or amniocentesis in such a pregnancy would report “male,” while the baby’s appearance at birth would be female.

Congenital adrenal hyperplasia (CAH) creates the opposite mismatch. In this group of inherited conditions, the adrenal glands overproduce androgens, which can cause the external genitalia of an XX female fetus to become masculinized.16PubMed Central. Congenital adrenal hyperplasia in pregnancy: approach depends on who is the ‘patient’ The degree of masculinization varies widely.17PubMed. The adrenal cortex and sexual differentiation during early human development In some forms, the virilization is driven by an alternative biochemical pathway that converts precursor hormones into a potent androgen without going through testosterone at all, which explains why some affected girls are born virilized even when their circulating testosterone levels are low.18PubMed Central. Alternative pathway androgen biosynthesis and human fetal female virilization

These conditions are uncommon, but they matter for the question of when sex is “determined” because they show that chromosomal sex, gonadal sex, hormonal sex, and anatomical sex are distinct layers that usually align but don’t always. A chromosomal test, a hormone level, and an ultrasound can each give a different answer in the same pregnancy, and all three answers can be biologically correct for the layer they’re measuring.

Brain Development Follows Its Own Timeline

Sexual differentiation doesn’t stop at the genitalia. Research on the developing brain suggests that structural differences between male and female brains emerge on a separate and later timeline than genital development. The external genitalia differentiate in the first two months of pregnancy, while brain differentiation influenced by the hormonal environment appears to begin in the second half of pregnancy.19PubMed. Sexual differentiation of the human brain in relation to gender identity and sexual orientation

Because these two processes happen at different times, they can be influenced by different conditions. This independence means that the degree of masculinization in the genitalia does not necessarily reflect what has happened in the brain.20PubMed. Sexual differentiation of the brain and behavior The science here is still evolving, and the precise mechanisms and timing of human brain sexual differentiation remain under active investigation. One older study searching for steroid hormone receptors in human fetal brain tissue during weeks fourteen to twenty found none at detectable levels, suggesting that hormonally driven brain differentiation is unlikely to occur in the mid-trimester and may be concentrated even later than previously thought.21European Journal of Obstetrics & Gynecology and Reproductive Biology. Sexual differentiation of the human midtrimester brain

The Sex Ratio Isn’t Static During Pregnancy

One surprising finding from large-scale pregnancy data is that the ratio of male to female fetuses changes as pregnancy progresses. The comprehensive analysis mentioned earlier, combining data from early embryos, induced abortions, prenatal testing, fetal deaths, and live births, found a complex trajectory. Among abnormal embryos, the sex ratio was skewed toward males, while among normal embryos, it was skewed toward females. The ratio appears to dip in the first week or so after conception due to higher male mortality, then rises for at least ten to fifteen weeks as female mortality exceeds male mortality, levels off around twenty weeks, and declines again slowly from twenty-eight to thirty-five weeks as male mortality increases once more.2PubMed Central. The human sex ratio from conception to birth

The overall result is that total female mortality during pregnancy actually exceeds total male mortality, even though the slight male excess at birth (about 105 boys per 100 girls) gives the impression that the reverse is true. The common belief that “more boys are conceived but more boys die in utero, so it roughly evens out” turns out to be a simplification that gets the details wrong.

Hormonal Exposures and External Genital Formation

A common concern among parents who took oral contraceptives or other hormonal medications before realizing they were pregnant is whether those hormones could have affected the baby’s sexual development. A meta-analysis specifically addressing first-trimester exposure to sex hormones, including oral contraceptives, found no increased risk of external genital malformations. The overall odds ratio was 1.09 with a confidence interval spanning 0.90 to 1.32, and for oral contraceptive exposure specifically, the odds ratio was 0.98.22Obstetrics & Gynecology. Fetal genital effects of first-trimester sex hormone exposure: A meta-analysis In practical terms, accidental early-pregnancy exposure to birth control pills does not appear to alter fetal genital development.

How Other Species Do It Differently

Humans determine sex genetically, at fertilization, with no ability to change it afterward. But this is far from the only system in nature. Many reptiles, including all crocodilians and many turtles, use temperature-dependent sex determination, where the temperature of the nest during a critical window of incubation determines whether eggs hatch as male or female. There is no sex-chromosome difference at all in those species. A comparison across 181 reptile species found that species using temperature-dependent determination show significantly more variation in sex ratios across life stages than those using genetic determination, which makes intuitive sense: when environmental temperature can shift the ratio, year-to-year fluctuations in weather create population-level swings.23PubMed Central. Sex ratios and bimaturism differ between temperature-dependent and genetic sex-determination systems in reptiles

Some fish can change sex during adulthood in response to social cues: certain wrasse and clownfish species routinely transition from one sex to another when population dynamics shift. Compared to these systems, the mammalian arrangement is rigid. Once the sperm and egg meet, the genetic sex is permanent, and the developmental cascade that follows is remarkably difficult to redirect, though as the conditions discussed earlier demonstrate, the hormonal steps downstream of chromosomal sex can occasionally diverge from the expected path.

Ancient Theories About Sex Determination

For most of human history, the mechanisms behind fetal sex were a complete mystery, which left the field wide open for speculation. The Greek philosopher Parmenides, writing in the fifth century BC, claimed that the sex of a child depended on its position in the womb, with males on the right and females on the left. His near-contemporary Anaxagoras shifted the focus to the father, proposing that boys came from sperm produced by the right testicle and girls from the left. Empedocles took a different approach entirely, suggesting that sex was determined by the balance of elemental qualities like heat and cold.24Biomedical Journal of Scientific & Technical Research. History of The Research on Sex Determination

Variations on these ideas persisted for centuries. The “right side/left side” theory was popular enough that some historical medical texts recommended tying off one testicle to produce a child of the desired sex. The discovery of sex chromosomes in the early twentieth century finally put these folk theories to rest scientifically, though cultural myths about influencing fetal sex through diet, lunar cycles, or sexual positioning survive online to this day. None of them have any biological basis.