Which Sexually Transmitted Diseases Cause Erectile Dysfunction?
Chlamydia, gonorrhea and HIV have all been linked to erection problems. How each one may play a part, and why testing and treatment come first.
Updated 5 min read

Sexually transmitted infections (STIs, often called STDs) are common, and many cause no symptoms at all. Most men think of them as a short-term problem: get tested, take the antibiotics, move on. But some STIs can affect erections, either directly through the prostate and nearby organs, or indirectly through stress, pain and other health effects.
Here is what the evidence says about the main ones.
Chlamydia
Chlamydia is a common infection in both men and women [1]. Many men have no symptoms. When symptoms do show up, they can include discharge from the penis, pain or burning when you pee, and, less often, pain and swelling in one or both testicles [1].
If it is not treated, chlamydia can spread to the tubes attached to the testicles, causing pain and fever, and in rare cases it can affect fertility [1].
Chlamydia and the prostate
The prostate sits just below the bladder, around the urethra. Doctors have long suspected that chlamydia can travel up the urethra and infect the prostate, causing prostatitis. A review in the International Journal of Antimicrobial Agents explains that this link is hard to prove, partly because tests can pick up bacteria from the urethra rather than the prostate itself [2]. So the connection is possible, but not settled.
Gonorrhea
Gonorrhea is another bacterial STI. Men who have symptoms may notice burning when they pee, discharge from the penis, or, less often, painful or swollen testicles [3]. Like chlamydia, untreated gonorrhea can cause a painful condition in the tubes attached to the testicles, which in rare cases may lead to infertility [3].
Gonorrhea can be cured with the right treatment, but drug-resistant strains are increasing, which makes some infections harder to treat [3]. That is one more reason to get tested and treated early.
How prostatitis connects to ED
Prostatitis means inflammation of the prostate. In its long-term form (often called chronic prostatitis or chronic pelvic pain syndrome), sexual problems are common. A meta-analysis of 24 studies including more than 11,000 men with this condition estimated that about 29% had ED [4]. Pain in the pelvis, pain with ejaculation and the stress of living with a long-term condition can all make sex harder.
Not every case of prostatitis comes from an STI, and many have no clear cause. But if you have pelvic pain, pain when you ejaculate or burning when you pee along with erection problems, a doctor should check for infection.
HIV
HIV is the STI most clearly linked to ED in research. A meta-analysis found that men with HIV were more likely to have ED than men without it [5]. A review in the Journal of Clinical Medicine notes that ED is the most common sexual problem in men living with HIV, even in men under 40 [6].
The reasons seem to be a mix [6]:
- Health problems that often come along with HIV
- Fear of passing the virus to a partner
- Changes in body image
- The stress and stigma that can come with an HIV diagnosis
The same review points out that sexual problems are often not discussed in routine HIV care [6]. If you are living with HIV and have ED, bring it up. It is a common, treatable problem.
Don't stop your HIV medicine or any other prescribed medicine because of ED. Talk to the doctor who prescribes it. They can look at the cause and, if needed, adjust your treatment. Tell any provider treating your ED about every medicine you take, including HIV medicines.
The emotional side
Finding out you have an STI can be stressful. Worry about your health, guilt, fear of infecting a partner or tension in a relationship can all get in the way of erections. That kind of stress is part of why the HIV research above points to stigma and fear as contributors [6].
Testing, treatment and prevention
- Get tested if you have symptoms, a new partner, or a partner who has an STI.
- Finish your treatment. Chlamydia can be cured with the right treatment, but it will not undo damage that has already happened [1].
- Retest. The CDC recommends testing again about three months after treatment for chlamydia or gonorrhea, even if your partner was treated too [1][3].
- Lower your risk. The only sure way to avoid STIs is not having vaginal, anal or oral sex. Otherwise, using condoms correctly every time and being in a mutually monogamous relationship with a tested partner lower your risk [1].
When to see a doctor
See a doctor if you have:
- Discharge from the penis, or burning when you pee
- Pain or swelling in the testicles
- Pain in the pelvis, between the scrotum and anus, or when you ejaculate
- Erection problems that continue after an infection has been treated
If your ED started during or after another illness, see can being sick cause erectile dysfunction. Medicines can play a part too; see can blood thinners cause ED.
Getting ED treatment through Invigor
If erection problems are sticking around after the cause above has been looked at, Invigor can help you explore treatment. Start with a free online assessment. A licensed U.S. provider reviews your health history and your medicines and decides whether a treatment such as sildenafil or tadalafil is appropriate for you. If it is prescribed, your medication ships from a state-licensed U.S. pharmacy.
Frequently asked questions
Possibly, though it is not proven. Chlamydia has long been suspected as a cause of prostatitis [2], and long-term prostatitis is linked to ED [4].
Sources & references
- About Chlamydia. Centers for Disease Control and Prevention. 2024
- The role of Chlamydia trachomatis in prostatitis. International Journal of Antimicrobial Agents. 2002
- About Gonorrhea. Centers for Disease Control and Prevention. 2024
- Prevalence of sexual dysfunction in men with chronic prostatitis/chronic pelvic pain syndrome: a meta-analysis. World Journal of Urology. 2016
- Association Between HIV Infection and Prevalence of Erectile Dysfunction: A Systematic Review and Meta-Analysis. The Journal of Sexual Medicine. 2017
- HIV and Sexual Dysfunction in Men. Journal of Clinical Medicine. 2021
Contributors
Written by
Editorial team
The team that writes, edits and fact-checks articles on Try Invigor.
View profile
This article is for education only. It is not medical advice, and it is not a diagnosis or a prescription. Where a clinician is named as its reviewer, they reviewed it for medical accuracy. Talk to your own clinician before you start, stop or change any treatment.


