Pregnancy tests work by checking your urine (pee) for a hormone called human chorionic gonadotropin (HCG). Your body only makes this hormone if you're pregnant. HCG is released when a fertilized egg attaches to the lining of your uterus — when pregnancy begins.