This is one of the most common questions doctors get from parents-to-be. If you're dying to know whether to stock up on pink or blue onesies, you'll likely have to wait until you're about 18 to 20 weeks along. Doctors can usually determine the baby's sex during a routine ultrasound visit at this time, but not always.
The position of the baby during the ultrasound is key, and if your baby's curled up or facing the wrong way, you may have to wait until your next appointment. For obvious reasons, it's usually easier to see if your baby is a boy.
Moms-to-be who undergo amniocentesis—a prenatal test that's used to check for certain genetic problems, usually around 16 weeks—can also find out whether they're having a boy or a girl at that time. The test, usually given to moms 35 or older, involves inserting a needle into the uterus to remove a small amount of amniotic fluid. This test isn't without risk, however, and isn't performed simply to determine the sex of your baby.
Another test that can look at the baby's chromosomes is called CVS (chorionic villus sampling), which is performed during the first trimester to look for problems with the baby's chromosomes. However, this test is infrequently used.
I'm often asked if you can tell the baby's sex by the heart rate—based on the myth that one sex is faster than another—but that's just an old wives' tale. Some people claim they can predict the baby's sex by the way you're carrying, but, again, there is no scientific proof that this is true. Still others use a "pendulum test" in which an object is suspended over the pregnant belly and the baby's sex is revealed depending on which way the pendulum swings. Again, there is no documented proof that this test works.
Don't get frustrated if the doctor can't tell what the baby's sex is on ultrasound. You'll know soon enough; in the meantime, just buy green or yellow clothes and accessories!