How Do You Get HIV? Risks, Prevention, and Testing

HIV spreads through specific body fluids: blood, semen, pre-seminal fluid, rectal fluids, vaginal fluids, and breast milk. For transmission to occur, these fluids must come into contact with damaged tissue, a mucous membrane (found inside the rectum, vagina, penis, and mouth), or be directly injected into the bloodstream. The most common routes are sex without a condom or PrEP and sharing needles.

Sexual Transmission

Sex is the primary way HIV spreads worldwide, but the risk varies significantly depending on the type of sex. Receptive anal sex carries the highest per-act risk: roughly 1 in 72 exposures with an HIV-positive partner who isn’t on treatment. Insertive anal sex is much lower at about 1 in 909. For vaginal sex, the receptive partner faces a risk of about 1 in 1,250 per act, while the insertive partner’s risk is approximately 1 in 2,500.

These numbers represent averages without condoms, PrEP, or treatment for the HIV-positive partner. Real-world risk for any single encounter depends on several factors, including viral load, whether other sexually transmitted infections are present, and whether there are tears or sores in the tissue.

The virus gets through the body’s defenses in a few ways. During sex, tiny tears in the lining of the rectum, vagina, or foreskin create openings. HIV can also slip between cells in these delicate tissues or be actively transported across them. Once past that barrier, immune cells just beneath the surface pick up the virus and pass it to the very cells HIV targets, a type of white blood cell called CD4 cells. The rectum’s thin, single-cell lining is especially vulnerable, which is why anal sex carries the highest risk.

How Other STIs Raise the Risk

Having another sexually transmitted infection can make you significantly more vulnerable to HIV. Infections that cause open sores, like herpes or syphilis, create direct entry points. But even STIs without visible sores increase risk by drawing large numbers of immune cells to the genital or rectal area, giving HIV more targets to infect. A study in Open Forum Infectious Diseases found that men with a history of rectal gonorrhea had roughly double the risk of acquiring HIV compared to those without, and those with repeated rectal gonorrhea infections faced more than six times the risk.

Blood-to-Blood Contact

Sharing needles or syringes is the most efficient non-sexual route of transmission. When someone injects drugs with equipment that was used by a person living with HIV, even a small amount of blood remaining in the needle can carry enough virus to cause infection. This also applies to any equipment used to prepare drugs, such as cookers or cotton filters, that may contain traces of blood.

Needlestick injuries in healthcare settings can transmit HIV, though the risk per incident is low, roughly 0.23%. Blood transfusions carried significant risk in the early years of the epidemic, but donated blood in the U.S. and most high-income countries has been screened since 1985, making this route extremely rare today.

From Parent to Child

HIV can pass from mother to child during pregnancy, labor, delivery, or breastfeeding. Without any treatment, the transmission rate ranges from 15% to 45%. With consistent antiretroviral treatment that keeps the mother’s viral load undetectable, the risk during pregnancy and delivery drops to under 1%. The same applies to breastfeeding: for mothers on treatment with a sustained undetectable viral load, the risk through breast milk is less than 1%, though not zero.

Ways HIV Does Not Spread

HIV is not transmitted through saliva, sweat, tears, or casual contact. You cannot get HIV from hugging, shaking hands, sharing food or drinks, using the same toilet, or being bitten by a mosquito. Saliva does not carry enough virus to cause infection, and the CDC confirms there is no chance of transmission from spitting or kissing. Contact with unbroken skin also poses zero risk, because the outer layer of skin provides an effective barrier the virus cannot cross.

Undetectable Means Untransmittable

One of the most important developments in HIV prevention is the concept known as U=U. A person living with HIV who takes antiretroviral treatment and maintains an undetectable viral load has zero risk of transmitting the virus to sexual partners. This isn’t a rough estimate. Large studies tracking thousands of couples where one partner was HIV-positive and on effective treatment recorded zero transmissions. The CDC states this plainly: undetectable equals untransmittable.

Prevention Tools That Work

PrEP (pre-exposure prophylaxis) is a medication taken by HIV-negative people to prevent infection. When taken as prescribed, PrEP reduces the risk of getting HIV from sex by about 99%. For people who inject drugs, it reduces the risk by at least 74%. PrEP is available as a daily pill or a long-acting injection given every two months.

Condoms remain highly effective when used consistently. They block the exchange of fluids that carry the virus. Combining condoms with PrEP or a partner’s undetectable viral load layers protections and brings risk essentially to zero.

If you think you’ve been exposed to HIV, post-exposure prophylaxis (PEP) is an emergency option. PEP must be started within 72 hours of exposure, and the sooner the better. It involves taking antiretroviral medication for 28 days. Observational research suggests PEP reduces the risk of infection by more than 80%, and effectiveness is likely much higher when taken consistently and exactly as prescribed. Every hour counts, so if you suspect a recent exposure, seek care immediately rather than waiting.

When and How to Test

No HIV test can detect the virus the day after exposure. Each type of test has a “window period,” the time between potential exposure and when the test can reliably pick up infection. A nucleic acid test (NAT), which looks for the virus itself in your blood, has the shortest window at 10 to 33 days. An antigen/antibody test run on blood drawn from a vein can detect HIV 18 to 45 days after exposure. The same type of test done with a finger stick has a wider window of 18 to 90 days. Antibody-only tests, including most rapid tests and home test kits, take 23 to 90 days to become reliable.

If you test negative but your potential exposure was recent, you may need to retest after the window period has fully passed to confirm the result. Testing earlier still has value, because a positive result at any point means you can start treatment sooner.