Medically reviewed by Kristin Hall, FNP
Written by Our Editorial Team
Last updated 6/2/2022
An erection is a physiological process in which your penis hardens and becomes larger, usually in response to some type of sexual stimulation.
Getting an erection might seem simple. However, it’s actually a complicated behind-the-scenes process that involves numerous local nerves around your penis, your brain and the complicated network of blood vessels that runs throughout your body.
The good news is that understanding how erections work isn’t that difficult. In fact, you can learn the basics of “what is an erection 101” in just a few minutes.
Below, we’ve explained what erections are, as well as how your body develops an erection (and just as importantly, gets rid of it again) when you feel sexually aroused.
We’ve also discussed erectile dysfunction (ED) and the factors that may prevent you from being able to properly get or maintain an erection.
Finally, we’ve shared some treatment options that you may want to consider if you find it difficult to get or maintain a firm erection when you want to have sex.
Getting an erection (or “penile tumescence,” as it’s sometimes referred to clinically) is a natural process that occurs when you feel sexually aroused. Like with many other common tasks, your body knows how to get an erection without ever requiring any instructions.
Erections usually begin with either mental or physical stimulation. You may start to feel sexually aroused when your see your partner’s body, feel their touch or watch pornography or any other type of sexually explicit material.
This sexual stimulation triggers a multi-step internal process that involves your nervous system and your cardiovascular system.
As you feel sexually stimulated, nerves located inside your penis — called the cavernous nerves — release natural chemicals called neurotransmitters. Neurotransmitters are naturally-occurring chemicals that your body uses to communicate with different nerve cells.
The neurotransmitters released by your penis and surrounding nerves cause the smooth muscle of your blood vessels to relax. This widens the diameter of your blood vessels and increases the supply of blood to the areas of erectile tissue inside your penis, called the corpora cavernosa.
As the blood vessels that supply your penis increase in size, so does blood flow. In fact, during the process of getting an erection, the flow of blood to your penis increases to approximately 20 to 40 times its normal level.
The amount of blood pressure inside your penis also increases when it’s erect, with the average man showing a blood pressure level of approximately 100 mmHg.
This increased blood flow is what gives your erection its size and firmness, allowing you to have sex with your partner.
In order to trap the extra blood inside your penis and help you maintain your erection during sex, a type of natural fibrous tissue called the tunica albuginea wraps around the corpora cavernosa and provides compression.
This prevents blood from flowing out of your penis until you’re either no longer aroused, or until after you’ve reached orgasm and ejaculated.
So, what happens after you’ve finished having sex and no longer need an erection? Maintaining an erection forever can put a lot of pressure on the tissue of your penis and potentially harm the internal erectile tissue.
In fact, there’s a specific health issue called priapism — a type of prolonged erection that occurs in certain circumstances — that can potentially lead to permanent erectile dysfunction when it’s left untreated.
Luckily, your body also has its own internal mechanism for getting rid of your erection when you no longer need it.
During sex, your penis remains in a phase called “rigid erection.” Following ejaculation, or when you no longer feel sexually aroused, it enters a new phase in which the emissary veins increase in size, allowing blood to flow out from your penis.
This outward flow of blood gradually reduces pressure inside your penis, causing it to decrease in size and become less firm.
All of this, from the sudden increase in blood flow and firmness to the reverse process after you reach orgasm and ejaculate, happens behind the scenes, allowing you to focus on the moment and enjoy sex.
So, if erections are all about a combination of sexual stimulation and consistent blood flow, what causes erectile dysfunction?
Erectile dysfunction is a condition in which you can’t develop or maintain a penile erection that’s firm enough to have satisfying sex with your partner. It’s a common issue — in fact, it affects an estimated 30 million men in the United States every year.
The symptoms of ED can vary in severity. Some men with erectile dysfunction find it impossible, or at least very difficult, to get an erection at any time. Others might be able to get an erection in some circumstances, but not in others.
Some men with ED might be able to develop an erection, but find it difficult to maintain it for long enough or keep a sufficient level of firmness to have sexual intercourse.
Most of the time, erectile dysfunction occurs when something prevents you from feeling sexually aroused, or when a physical health issue affects blood flow to your penis or nerve function in the surrounding area.
For example, several common causes of erectile dysfunction are physical health issues that can affect your major blood vessels, such as:
Heart disease (cardiovascular disease)
Atherosclerosis (clogged arteries)
Hypertension (high blood pressure)
These conditions could affect the flow of blood to your corpora cavernosa and prevent you from getting or maintaining an erect penis even when you feel sexually aroused.
Other medical conditions can also cause erectile dysfunction, including those that result in nerve damage, including to the somatic nerves and dorsal nerve of the penis. Any impairment of nerve function may affect communication between your penis and the rest of your nervous system.
Health conditions that may affect nerve function include:
Type 2 diabetes
Multiple sclerosis (MS)
Chronic kidney disease (CKD)
Injuries from prostate surgery or radiation therapy
Other injuries that affect the penis, spinal cord, prostate gland, pelvis and bladder
Some medications used to treat certain medical conditions, such as antidepressants, appetite suppressants, antiandrogens (medications that affect testosterone levels), high blood pressure medicines and sedatives, may also cause or contribute to ED.
Most of these issues cause ED by either affecting nerve function, reducing blood flow or dulling sexual arousal.
In some cases, psychological issues can also affect the process of getting an erection and lead to erectile dysfunction. For example, ED is a known symptom of depression, anxiety (especially sexual performance anxiety) and chronic stress.
Even issues such as feelings of guilt about sex or low self-esteem can affect arousal and make it harder to get or maintain an erection.
You can think of these issues as acting like roadblocks — barriers that stop the normal process of sexual arousal, your nervous system and your cardiovascular system from working properly to give your penis the supply of blood it needs to get and stay hard during sex.
It’s far from uncommon to experience trouble with erections from time to time, whether it’s just some difficulty maintaining an erection sufficient for sex or more noticeable sexual dysfunction that prevents you from having sex at all.
The good news is that erectile dysfunction is almost always treatable, either by making certain changes to your lifestyle, using medication, taking part in therapy or a combination of different treatments.
Below, we’ve explained your options for improving your erectile function, sexual performance and overall well-being.
The first step in treating ED and improving your erections is to live a healthy lifestyle that’s free of issues that can affect sexual arousal, nerve function or blood flow to your penis.
This means maintaining healthy habits. Try to:
Eat a balanced diet. Try to eat a healthy diet that includes fresh fruits and vegetables, complex carbohydrates and lean sources of protein. Try to limit overly salty or sugary foods, as these may contribute to high blood pressure or diabetes.
Limit your alcohol intake. Alcohol can cause whiskey dick, or alcohol-induced ED. It’s okay to drink in moderation, but drinking to excess may increase your risk of developing erectile dysfunction.
Keep yourself physically active. Regular physical activity can improve blood flow and reduce your risk of developing vascular disease. Try to exercise for at least 30 minutes a day most days, even if it’s just a brisk walk or bike ride.
If you’re overweight, try to lose weight. Research suggests that being overweight or obese increases your risk of erectile dysfunction. Try to maintain a healthy weight for better sexual functioning and overall health.
If you smoke, quit. Smoking can harm your vascular anatomy (the blood vessels that allow blood to circulate through your body). This increases your risk of arterial disease, which is a significant risk factor for erectile dysfunction.
If you smoke, try to quit. Our guide to smoking and erectile dysfunction goes into more detail about the impact that smoking can have on your sexual performance, as well as the solutions that are available to help you kick the habit.
Avoid recreational drugs. Many illegal drugs don’t just affect your physical and mental health, but also your erections. If you live in a state with legal marijuana, avoid using it overly frequently, as marijuana may affect your sexual performance.
Our guide to naturally protecting your erections discusses other techniques that you can use to improve your erections and prevent ED naturally.
If you currently have an existing medical condition that affects your sexual arousal, blood flow or nerve function, treating it may help to improve your erections and sexual performance.
You can get help with an existing medical condition by visiting your primary care provider. They may ask you about your symptoms or perform a physical examination by inspecting your penis and taking your blood pressure.
In some cases, you may need to provide a urine or blood sample to check for conditions such as low testosterone or diabetes.
Your healthcare provider may prescribe medication to treat your condition. If you currently use medication, they may adjust your dosage or suggest switching to a new medication that’s less likely to affect your sexual response and/or function.
You can connect with a licensed healthcare provider for many common issues from home with our online primary care services.
Several FDA-approved medications are currently available to treat erectile dysfunction. These medications, which belong to a class of drugs called PDE5 inhibitors, work by improving blood flow to the erectile tissue inside your penis.
Currently, ED medications include sildenafil (the active ingredient in Viagra®), tadalafil (Cialis®), vardenafil (Levitra®) and avanafil (Stendra®).
These oral medicines can be taken before sex, allowing you to more easily get and maintain an erection during intercourse. Most start working within 15 to 60 minutes and can provide relief for anywhere from four to 36 hours per dose.
We offer several ED medications online, following a consultation with a healthcare provider who will determine if a prescription is appropriate.
You can also find out more about how these medications work in our guide to the most common ED treatments and drugs.
As a man, being able to get healthy, consistent erections is a critical component of maintaining a satisfying sex life.
Unfortunately, for many guys, getting an erection isn’t quite as easy as it should be, whether due to poor cardiovascular health, sexual performance anxiety or just an unhealthy, stressful lifestyle that makes staying sexually healthy difficult.
The good news is that almost all cases of erectile dysfunction are treatable with the right mix of healthy habits and, if necessary, erectile dysfunction medication.
Interested in finding out more about getting healthy erections? You can learn about the science behind erections in our list of surprising facts about erection health and ED, or access help with ED online with our range of evidence-based erectile dysfunction treatments.