Medically reviewed by Katelyn Hagerty, FNP
Written by Our Editorial Team
Last updated 5/5/2022
Erectile dysfunction, or ED, is a common sexual performance issue that affects an estimated 30 million men in the United States alone.
Most cases of erectile dysfunction are caused by physical and psychological health issues, such as hypertension (high blood pressure), cardiovascular disease, depression and anxiety. Several other factors, such as age and activity level, can also play a role in ED.
But can STDs cause erectile dysfunction? While not all sexually transmitted diseases are linked to erectile dysfunction, a few, such as gonorrhea, chlamydia, viral hepatitis and HIV, may cause infections in your prostate that can affect your erections and ability to have sex.
Below, we’ve explained what erectile dysfunction is, as well as the symptoms you may develop if you’re affected.
We’ve also discussed the causes of erectile dysfunction, including some STDs that may affect your sexual function and ability to get an erection.
Finally, we’ve explained what you can do if you have ED, from using prescription medication to making changes to your lifestyle and more.
Erectile dysfunction is a common sexual health condition. If you have erectile dysfunction, you may find it difficult or impossible to get or maintain an erection that’s firm enough to engage in sexual activity.
Although the term “erectile dysfunction” is usually associated with a complete inability to get or stay hard, the reality is that ED can vary in severity.
Some men with ED are able to get an erection relatively easily, but aren’t able to maintain it for long enough to have sex. Others can get an erection sometimes, but not every time they want to have sex. Others may not be able to get an erection at all, even when they feel aroused.
Although erectile dysfunction is most common in middle-aged and elderly men, it affects men of all ages and backgrounds.
Factors that may increase your risk of developing erectile dysfunction include certain conditions and diseases, using certain types of medication or having negative health factors, such as being overweight, smoking cigarettes or taking illicit drugs.
Our complete guide to erectile dysfunction goes into more detail about what ED is, common risk factors and more.
To understand what causes erectile dysfunction, it’s important to first understand how erections actually happen.
Getting an erection doesn’t seem overly complicated. However, behind the scenes, it requires a complex series of biological actions and responses in numerous different parts of your body, all of which need to work simultaneously to keep your penis firm during sex.
Erections start with sexual arousal. When you feel sexually stimulated, nerves in your penis and brain communicate with your vascular system, causing an increase in blood flow to the tissue in your penis.
These two bodies of erectile tissue, called the corpora cavernosa, grow in size as blood flows in from your blood vessels. On average, the flow of blood to your penis increases by around 20 to 40 times as your penis starts to become erect.
As blood flows to your penis, the ischiocavernosus and bulbospongiosus muscles, located near the base of the penis, contract. This traps blood inside your penis and allows you to maintain a firm, rigid erection during sexual intercourse.
After you reach orgasm and ejaculate, this process occurs in reverse, with the emissary veins of your penis draining the extra blood and causing your erection to disappear.
Erectile dysfunction usually occurs when one or several factors affect your level of arousal, your nerve function or your body’s ability to supply your penis with blood.
For example, erectile dysfunction is often caused by physical health issues that affect your vein or nerve function. These include:
Hypertension (high blood pressure)
Atherosclerosis (clogged arteries)
Chronic kidney disease
Some injuries, including those that affect your penis, spinal cord, prostate and surrounding area, can also cause or contribute to erectile dysfunction.
Contrary to popular belief, researchers generally don’t believe that aging directly contributes to erectile dysfunction. However, several physical health problems that cause ED tend to become more common as you grow older.
In addition to physical health issues, certain medications, psychological issues and even habits can cause or contribute to erectile dysfunction.
For example, ED is a known side effect of medications for high blood pressure, depression and anxiety, as well as some appetite suppressants and medications that work by reducing levels of androgen hormones such as testosterone.
Erectile dysfunction can also occur as a result of depression, anxiety, chronic stress and even feelings of guilt about sex, which may affect your level of sexual arousal and comfort.
Habits and lifestyle factors that may cause erectile dysfunction include smoking, drinking large amounts of alcohol, being physically inactive, having extra body fat and using illicit drugs.
So, can sexually transmitted diseases cause erectile dysfunction? The majority of STDs don’t appear to have any direct impact on your ability to get an erection. However, some may cause or contribute to other health issues that can cause erectile dysfunction.
For example, some infections spread through sex can potentially cause prostatitis — a form of inflammation that affects your prostate gland. If this inflammation becomes severe, there’s a risk that it could make it difficult for you to maintain an erection firm enough for sex.
Prostatitis can also cause other urinary and sexual symptoms, including pain while urinating or ejaculating. These issues can affect both your sexual functioning and your day-to-day quality of life.
In some cases, yes. Gonorrhea is a bacterial infection that spreads through sexual contact. It’s one of several bacterial STDs that can spread to your prostate gland and cause you to develop the symptoms of erectile dysfunction.
Common symptoms of gonorrhea in men include:
White, yellow or green discharge from the penis
Pain, discomfort and a burning sensation when urinating
Swollen and/or painful testicles
Gonorrhea is treatable with antibiotics, making it important to talk to your healthcare provider if you start to experience any of the symptoms above.
Chlamydia is an infection caused by the bacteria Chlamydia trachomatis. Like other STDs, it’s typically spread through sexual contact.
Not all people who have chlamydia develop symptoms. Men with symptomatic chlamydia may experience pain or tenderness that affects the testicles, a burning sensation while urinating and discharge from the penis and/or rectum.
Because chlamydia can spread to the prostate gland, it also has the potential to cause prostatic inflammation that may cause or contribute to ED.
Like gonorrhea, chlamydia is treatable. It’s important to talk to your healthcare provider as soon as possible if you notice any of the symptoms of chlamydia after sexual activity.
Other STDs may affect your sexual desire, health and performance. However, the link between most sexually transmitted diseases and your ability to get and maintain an erection hasn’t been extensively studied.
In addition to affecting your prostate gland, some sexually transmitted diseases can cause male accessory gland infections, or MAGIs. These infections may cause inflammation and damage to your urethra, epididymis, testes and seminal vesicles.
These issues can have a negative effect on your sexual function and fertility, making it important to treat STDs as soon as you experience recognizable symptoms.
Other STDs may play a role in the development of chronic health issues that affect your sexual health and contribute to long-term sexual dysfunctions.
For example, hepatitis C (or other forms of viral hepatitis), is associated with an increased risk of several forms of cancer, including prostate cancer. Although prostate cancer doesn’t cause ED directly, most forms of treatment for prostate cancer, including surgery, can contribute to erectile dysfunction.
Other sexually transmitted diseases, such as HIV, can attack your immune system and prevent it from functioning properly, which may increase your risk of developing infections that affect the tissue surrounding your penis and cause erectile dysfunction.
Currently, there’s limited evidence that syphilis or human papillomavirus (HPV) have any impact on erections. However, one study has found that the herpes simplex virus (HSV) is associated with an increased risk of erectile dysfunction.
Even sexually transmitted diseases that don’t physically cause erectile dysfunction may have a significant on your psychological wellbeing, including your level of confidence in bed.
Researchers have found that having an STD can have an adverse psychological impact on the sexual function of men. This may include issues such as performance anxiety, as well as a general increase in sex drive and avoidance of sexual encounters.
In other words, even when an STD doesn’t physically stop you from getting an erection, it could cause you to develop psychological erectile dysfunction.
Catching a sexually transmitted disease can be a stressful and frustrating experience, especially when it also causes you to develop erectile dysfunction.
The good news is that erectile dysfunction and almost all STDs are treatable, usually with a mix of medication and changes to your habits. Below, we’ve discussed what you can do if you have a sexually transmitted disease that you think is causing erectile dysfunction.
Many STDs can have a negative impact on your health if they’re left untreated. Some can even contribute to infertility, either for you or your sexual partner. The longer you wait to treat an STD, the more opportunities you also have to potentially transmit it to other people.
Because of this, it’s important to treat your sexually transmitted disease before you even start to think about treating erectile dysfunction.
If you think you have an STD, it’s important to talk to your primary care provider as soon as you can. Most STDs can be checked with a simple test, allowing you to find out if you have anything (and if so, what it is) within a few days.
Our list of the most common sexually transmitted infections goes over the STDs that affect most people, as well as common warning signs that you should look out for.
If you have a sexually transmitted disease, your primary care provider may prescribe medication to cure the infection and restore your normal sexual health.
It’s also important to get tested for STDs on a frequent basis if you’re sexually active. Our guide to how often you should be tested for sexually transmitted diseases explains why regular testing is so important, as well as where you can go to get an STD test.
If you still find getting an erection difficult after treating an STD, you may want to consider using ED medication to improve your erections and sexual performance.
These medications, which belong to a class of drugs called PDE5 inhibitors, work by increasing blood flow to your genital region and penis. This improvement in blood flow can make it easier to maintain an erection sufficient for satisfying, pleasurable sex.
Many medications for ED can be taken 15 to 60 minutes before sex, making them a convenient option if you’re prone to erectile dysfunction and want instant, effective relief.
In addition to treating any sexually transmitted diseases and using ED medication, there are a few simple changes that you can make to your habits and daily life for more reliable erections, better heart health and improved overall wellbeing. Try to:
Get plenty of physical activity, even if it just means going for a daily walk or bike ride.
Maintain a healthy body weight, especially if you’re currently overweight or obese.
Eat a healthy, balanced diet that’s rich in fresh fruits, vegetables and lean proteins.
If you have hypertension (high blood pressure) or diabetes, keep them under control.
Limit your alcohol intake by drinking in moderation and avoiding irresponsible drinking.
Avoid using illicit drugs, as these may affect your sex drive and sexual function.
If you smoke, make an effort to quit to improve your cardiovascular wellbeing.
Our list of ways to protect your erections naturally shares other lifestyle changes and healthy habits that you can use for better erections and sexual performance.
Sexually transmitted diseases can have a serious impact on your health. In some cases, they can even affect your ability to get and maintain an erection.
If you think you might have gonorrhea, chlamydia or any other STD, it’s important to speak to your healthcare provider as soon as possible. They’ll be able to test you for any STDs and, if necessary, prescribe medication to help you get rid of the infection.
In addition to getting yourself tested and treated, it’s also important to let your recent partners know about your current situation, especially if you have an STD that could cause infertility or long-term health problems.
If your erectile dysfunction persists after you treat your STD, you may want to consider taking medication to improve your erections. We offer a range of proven ED medications, which are available following an online consultation with a licensed healthcare provider.
Not sure where to start? You can learn more about the best medications for dealing with ED in our full guide to the most common erectile dysfunction treatments and drugs.