There are a number of medical tests available to determine the sex of an unborn baby, according to WebMD. Ultrasound, amniocentesis, chorionic villus sampling and DNA tests are all highly accurate methods.
An ultrasound performed between weeks 18 and 20 of a pregnancy can show with 80 to 90 percent accuracy whether the fetus is male or female, provided the technician has a clear view of the genitals, explains WebMD. Fetal ultrasounds are a routine test considered safe for both mother and child, and there is no evidence of negative side effects in children in the several years after birth, according to Mayo Clinic.
Ultrasounds can produce images of the womb and fetus by using sound waves. A transducer emits a high frequency sound that human ears cannot detect and uses the echoes of returned sound waves to discern the size, shape and consistency of soft tissues and organs, explains WebMD.
Amniocentesis and chorionic villus sampling are similarly accurate tests, but they are much more invasive and are generally used only in cases where the baby potentially has a genetic disorder or chromosomal abnormality, such as Down syndrome, notes WebMD. DNA tests of the mother's blood are an expensive but accurate method used to determine a baby's sex. Due to their high cost, these tests are not widely available and are reserved for specialized laboratories.