"X-ray" might be the most familiar term for a lot of people, but the three most common imaging tests (X-rays, MRIs, and CT scans) have different techniques and levels of detail.
X-rays are most often used to produce images of bones, but they can image any structure inside your body. To do this, X-ray beams are projected and absorbed by your body. Depending on the density of your body in different places, the X-ray image will show different colors. The most dense parts, like bones, will appear white. Less dense parts like fat and muscle will look gray, and air will look black. Sometimes doctors will use iodine or barium as a contrasting image to see detail on the X-ray more clearly.
Although X-rays are especially helpful for bone fractures, decay, or cancer, they can also be used to diagnose problems in the lungs, breasts, heart, blood vessels, and digestive tract. The test is totally painless, but some people do have a reaction to the contrast medium if it's used. Because of the small amount of radiation involved, some doctors prefer to use ultrasounds for patients who are pregnant.
MRIs, like X-rays, are used to create images of the body. MRIs do this through magnetic resonance images rather than X-ray beams. You lie inside a tube-shaped machine, which uses magnets to move hydrogen atoms in your body. The MRI machine releases radio waves so these atoms will create a faint signal it can pick up and use to make the MRI image. The images they create are more detailed than X-ray images and can be used to diagnose more medical conditions.
MRIs are most often used for imaging the brain and spinal cord, but they can also be used for the eye, inner ear, blood vessels, bones, heart, and tumors in many other organs. MRIs are painless, but there can be problems if you have metal or electronic devices in your body. Some examples include metal clips, pacemakers, cochlear implants, or a heart defibrillator. Because the effects of magnetic fields on fetuses aren't clear, doctors may choose a different exam for pregnant patients.
CT stands for computerized tomography, which basically means a computer showing a detailed image of a part of your body using X-rays. CT scans take a bunch of X-ray images from different angles and put them together on a computer, giving doctors a cross-sectional image of your bones, blood vessels, and soft tissue. CT scans are more detailed that standalone X-rays, but they're less detailed than MRIs.
CT scans are most useful for examining internal injuries, diagnosing diseases, and planning surgical or radiation treatment. It is possible for the contrast medium to cause a reaction, but it's rare. Because CT scans use multiple X-rays, there is a larger amount of radiation exposure, but it's still a relatively small amount. However, doctors may still recommend a different exam for patients who are pregnant.
X-rays, MRIs, and CT scans are valuable diagnostic tools because they can produce detailed images of the body in just a few seconds (for an X-ray), a short 15-30 minutes (for a CT scan, though sometimes it can take longer), or closer to an hour (for an MRI, though sometimes it can take as little as 20-30 minutes). The costs of each test range based on how many images need to be taken and whether or not the test is covered by insurance. If you have questions about having any of these tests performed, you should reach out to your healthcare provider.