The earliest you can accurately determine the gender of a baby is around 6 weeks into pregnancy using a prenatal blood test that detects the baby's DNA in the mother's bloodstream with up to 99.9% accuracy. Traditional ultrasounds typically reveal the baby's gender around 18 to 22 weeks, while the "nub theory" ultrasound method can predict gender with about 70% accuracy as early as 11 weeks. More advanced genetic testing, such as noninvasive prenatal testing (NIPT), can determine gender from around 10 weeks with high accuracy, though definitive diagnostic tests like amniocentesis provide certainty later on.