Enjoy sex like you used to

Learn more

What Is an Erection and How Do They Work?

Kelly Brown MD, MBA

Reviewed by Kelly Brown MD, MBA

Written by Geoffrey C. Whittaker

Published 06/01/2022

Updated 05/06/2024

Men typically discover their penis and its erectile capabilities at an early age. But unless you paid incredible attention in grade-school anatomy class, chances are, you still have some questions — some of which might be very practical. Like, what is an erection, exactly?

An erection is a physiological process in which your penis hardens and becomes larger, usually in response to some type of sexual stimulation. While it may seem to happen automatically at times, it’s actually a complicated, behind-the-scenes operation.

Below, we’ll explain what erections are, how they work, why erectile dysfunction (ED) happens and the factors that may prevent you from being able to properly get or maintain an erection.

Maybe you call it “getting hard,” “engorgement” or “penile tumescence.” In any case, erections are a natural response that occurs when you feel sexually aroused. Erections usually begin with either mental or physical stimulation, which triggers a multi-step internal process involving the nervous system and cardiovascular system.

As you feel sexually stimulated, nerves located inside your penis — known as cavernous nerves — release natural chemicals called neurotransmitters. Your body uses neurotransmitters 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 erectile tissue inside your penis, called the corpora cavernosa. At that point, your penis is still in a flaccid state, but these signals and the blood flow continue to increase. 

viagra online

genuine Viagra® makes it possible

From the beginning of blood flow, your erection is entering a cycle. As the blood vessels that supply your penis increase in size, so does blood flow. The erection, then, happens when that blood gets trapped and fills the tissues.

During the process of getting an erection, blood flow to your penis increases to 20 to 40 times its normal level. Blood pressure inside your penis also spikes when it’s erect, with the average man showing a blood pressure level of roughly 100 mmHg (millimeters of mercury).

This elevated blood flow is what gives your erection its size and firmness, allowing you to have penetrative sex with your partner.

To trap the extra blood inside your penis and help you maintain your erection during sex, a fibrous tissue called the tunica albuginea that surrounds the corpora cavernosa compresses it.

This prevents blood from flowing out of your penis until you’re either no longer aroused or have reached orgasm and ejaculated.

During sex, your penis usually stays in a “rigid erection” phase. Following ejaculation, or when you no longer feel sexually aroused, it enters a new phase in which the veins increase in size, allowing blood to flow out from your penis.

This outward flow of blood gradually reduces pressure inside your penis, making it 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.

As much as some guys might want to stay hard for a longer time, maintaining an erection forever can put lots of pressure on penile tissue and potentially harm the internal erectile tissue.

In fact, a specific health issue called priapism — a painful, prolonged erection — can potentially lead to permanent erectile dysfunction when left untreated.

Luckily, your body also has its own internal mechanism for getting rid of erections when you no longer need them.

Erectile dysfunction means you can’t get or maintain a penile erection firm enough to have satisfying sex with your partner. It’s a common issue affecting 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.

And then some guys with ED might be able to get an erection but find it difficult to maintain it long enough or keep a sufficient level of firmness to have sexual intercourse.

So, if erections are all about a combination of sexual stimulation and consistent blood flow, what causes erectile dysfunction is clearly an interruption of that process. But what interrupts the process? Get answers below.

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 major blood vessels, such as:

  • Heart disease (cardiovascular disease)

  • Atherosclerosis (clogged arteries)

  • Hypertension (high blood pressure)

  • Low testosterone

  • Diabetes

Other medical conditions can also cause erectile dysfunction, including those that result in damage to the somatic nerves and dorsal nerves of the penis. Any impairment of nerve function or the spinal cord can affect communication between your penis and the rest of your nervous system.

Medications used to treat certain medical conditions — like antidepressants, appetite suppressants, antiandrogens (drugs that affect testosterone levels), high blood pressure medicines and sedatives — may also cause or contribute to ED.

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 mess with arousal and make it harder to get or maintain an erection.

Choose your chew

The good news is that erectile dysfunction is almost always treatable. Treatment can involve making certain changes to your lifestyle, using medication, taking part in therapy or a combination of approaches.

Let’s go over options for improving erectile function, sexual performance and overall well-being.

Maintain Good Habits and a Healthy Lifestyle

The first step in treating ED and improving erections is to live a healthy lifestyle 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. Aim to eat nutritious meals with 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 alcohol intake. Drinking can cause “whiskey dick,” also known as alcohol-induced ED. It’s okay to sip and cheers in moderation, but drinking to excess could increase your risk of developing erectile dysfunction.

  • Stay 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 most days, even if it’s just a brisk walk or bike ride.

  • Consider weight loss. Research suggests that having overweight or obesity increases your risk of ED. Try to maintain a healthy weight for better sexual functioning and overall health.
    If you smoke, quit. Smoking can elevate your risk of arterial disease, a significant risk factor for ED-. Our guide to smoking and erectile dysfunction goes into more detail about the impact cigarettes can have on sexual performance and solutions 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. Even if you live in a state with legal recreational marijuana, avoid using it too frequently, as THC may affect sexual performance.

Our guide to naturally protecting your erections discusses other techniques for improving erections and preventing ED.

Treat Any Underlying Health Issues

If you have an existing medical condition that affects sexual arousal, blood flow or nerve function, treating it may help improve your erections and sexual performance.

Your healthcare provider may prescribe medication to treat your condition. If you currently use medication, they might adjust your dosage or suggest switching to a new medication that’s less likely to affect your sexual response.

You can connect with a licensed healthcare provider from home for many common issues with our online primary care services.

Consider Using Medication for ED

Several FDA-approved medications are available to treat erectile dysfunction. They belong to a class of drugs called PDE5 inhibitors and work by improving blood flow to the erectile tissue inside your penis.

ED medications include sildenafil (the active ingredient in Viagra®), tadalafil (generic for Cialis®), vardenafil (Levitra®) and avanafil (Stendra®).

We offer several ED medications online, following a consultation with a healthcare provider who’ll 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.

Sildenafil citrate

Get hard for 95% cheaper than Viagra

As a man, being able to get healthy, consistent erections is a critical component of maintaining a satisfying sex life.

For guys Googling, “What’s an erection?” or “How does the penis work?” or “What does it mean to ‘get hard’?” there are simple answers — but also very complex ones.

Here’s what to keep in mind:

  • Unfortunately, getting an erection isn’t quite as easy as it should be for many guys.

  • This might be due to poor cardiovascular health, sexual performance anxiety or just a 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.

Learn about the science behind erections in our list of surprising facts about erection health and ED.

You can also get online ED help with our range of evidence-based erectile dysfunction treatments. 

8 Sources

  1. Panchatsharam, P.K., Durland, J. & Zito, P.M. (2021, May 9). Physiology, Erection. StatPearls. Retrieved from https://www.ncbi.nlm.nih.gov/books/NBK513278/
  2. Silberman, M., Stormont, G. & Hu, E.W. (2022, February 8). Priapism. StatPearls. Retrieved from https://www.ncbi.nlm.nih.gov/books/NBK459178/
  3. Definition & Facts for Erectile Dysfunction. (2017, July). Retrieved from https://www.niddk.nih.gov/health-information/urologic-diseases/erectile-dysfunction/definition-facts
  4. Symptoms & Causes of Erectile Dysfunction. (2017, July). Retrieved from https://www.niddk.nih.gov/health-information/urologic-diseases/erectile-dysfunction/symptoms-causes
  5. Preventing Erectile Dysfunction. (2017, July). Retrieved from https://www.niddk.nih.gov/health-information/urologic-diseases/erectile-dysfunction/prevention
  6. Bogdański, P., Skrypnik, D. & Musialik, K. (2014, February). ​Obesity—significant risk factor for erectile dysfunction in men. Polski Merkuriusz Lekarski : Organ Polskiego Towarzystwa Lekarskiego. 36 (212), 137-41. Retrieved from https://pubmed.ncbi.nlm.nih.gov/24720114/
  7. Erection problems. (2019, September 16). Retrieved from https://medlineplus.gov/ency/article/007617.htm
  8. Dhaliwal, A. & Gupta, M. (2021, June 25). PDE5 Inhibitors. StatPearls. Retrieved from https://www.ncbi.nlm.nih.gov/books/NBK549843/
Editorial Standards

Hims & Hers has strict sourcing guidelines to ensure our content is accurate and current. We rely on peer-reviewed studies, academic research institutions, and medical associations. We strive to use primary sources and refrain from using tertiary references. See a mistake? Let us know at [email protected]!

This article is for informational purposes only and does not constitute medical advice. The information contained herein is not a substitute for and should never be relied upon for professional medical advice. Always talk to your doctor about the risks and benefits of any treatment. Learn more about our editorial standards here.

Kelly Brown MD, MBA
Kelly Brown MD, MBA

Dr. Kelly Brown is a board certified Urologist and fellowship trained in Andrology. She is an accomplished men’s health expert with a robust background in healthcare innovation, clinical medicine, and academic research. Dr. Brown is a founding member of Posterity Health where she is Medical Director and leads strategy and design of their Digital Health Platform, an innovative education and telehealth model for delivering expert male fertility care.

She completed her undergraduate studies at University of North Carolina at Chapel Hill (go Heels!) with a Bachelor of Science in Radiologic Science and a Minor in Chemistry. She took a position at University of California Los Angeles as a radiologic technologist in the department of Interventional Cardiology, further solidifying her passion for medicine. She also pursued the unique opportunity to lead departmental design and operational development at the Ronald Reagan UCLA Medical Center, sparking her passion for the business of healthcare.

Dr. Brown then went on to obtain her doctorate in medicine from the prestigious Northwestern University - Feinberg School of Medicine and Masters in Business Administration from Northwestern University - Kellogg School of Management, with a concentration in Healthcare Management. During her surgical residency in Urology at University of California San Francisco, she utilized her research year to focus on innovations in telemedicine and then served as chief resident with significant contributions to clinical quality improvement. Dr. Brown then completed her Andrology Fellowship at Medical College of Wisconsin, furthering her expertise in male fertility, microsurgery, and sexual function.

Her dedication to caring for patients with compassion, understanding, as well as a unique ability to make guys instantly comfortable discussing anything from sex to sperm makes her a renowned clinician. In addition, her passion for innovation in healthcare combined with her business acumen makes her a formidable leader in the field of men’s health.

Dr. Brown is an avid adventurer; summiting Mount Kilimanjaro in Tanzania (twice!) and hiking the incredible Torres del Paine Trek in Patagonia, Chile. She deeply appreciates new challenges and diverse cultures on her travels. She lives in Denver with her husband, two children, and beloved Bernese Mountain Dog. You can find Dr. Brown on LinkedIn for more information.

Education & Training


Published as Kelly Walker

Read more

Related Articles

Start your ED assessment

Answer a few questions so we can help