A hysterosalpingogram (HSG) is an X-ray test that looks at the inside of the uterus and fallopian tubes and the area around them. It often is done for women who are having a hard time becoming pregnant.During a hysterosalpingogram, a dye (contrast material) is put through a thin tube that is put through the vagina and into the uterus. Because the uterus and the fallopian tubes are hooked together, the dye will flow into the fallopian tubes. X-rays are taken as the dye passes through the uterus and fallopian tubes. The pictures can show problems such as an injury or abnormal structure of the uterus or fallopian tubes, or a blockage that would prevent an egg moving through a fallopian tube to the uterus. A blockage also could prevent sperm from moving into a fallopian tube. A hysterosalpingogram also may find problems on the inside of the uterus that prevent a fertilized egg from attaching (implanting) to the uterine wall.