Paternity tests determine the relationship between babies and their fathers. If you want to know the father of your baby for legal or medical reasons, you do not have to wait until the birth of the baby.

Healthline explains how paternity tests while pregnant work.

How an amniocentesis works

Doctors use a thin needle to take a sample of amniotic fluid through the abdomen. Amniocentesis has a 99 percent chance of accuracy. You can have this test between 14 and 20 weeks. While many use it to detect chromosome abnormalities, genetic disorders and neural tube defects.

Amniocentesis carries a small risk of miscarriage and so you need a doctor’s permission to use it as a paternity test only. The side effects may include irritation, cramping, bleeding or an amniotic fluid leak.

How chorionic villus sampling works

Chorionic villus sampling is an invasive test that requires a thin needle or tube inserted through the cervix. Doctors use an ultrasound to guide the needle to collect pieces of tissue attached to the uterine wall. These small pieces of tissue are chorionic villi.

The chorionic villi and your baby have the same genetics. A lab can compare the DNA to the sample. You can have a CVS between 10 and 13 weeks.

How noninvasive prenatal paternity tests work

The noninvasive test is one of the best and most correct tests that you can take during pregnancy. Doctors take a blood sample from you and the alleged father. Then, the laboratory conducts a fetal cell analysis. Scientists can use fetal cells to create a genetic profile. You can have this test after the eighth week.