An erection is when a penis hardens and enlarges due to filling up with blood. Erections typically occur when a person with a penis is sexually aroused, but it can happen spontaneously.
An erection is when your penis becomes hard and enlarged from an increase in blood flow. This increase in blood flow makes your penis stand up and away from your body (erect). Sexual stimulation or excitement is the typical cause of an erection. But people can get random or spontaneous erections. Erections go away after you ejaculate, but can also go away without ejaculating.
To better understand how an erection happens, it helps to know what your penis is made of. A penis consists of:
Cleveland Clinic is a non-profit academic medical center. Advertising on our site helps support our mission. We do not endorse non-Cleveland Clinic products or services. Policy
An erection begins with sensory and mental stimulation in your brain. Your brain sends messages to your penis via your nerves.
Essentially, these messages tell the muscles of your corpora cavernosa (this contains the sponge-like material) to relax, allowing blood to flow in and fill the open spaces. When the blood vessels of the corpora cavernosa relax and open up, blood rushes in to fill them. The blood then gets trapped under high pressure by a series of valves, creating an erection.
The tunica albuginea (a membrane surrounding the corpora cavernosa), helps to trap the blood in the corpora cavernosa, so you stay hard.
An erection is reversed when muscles in your penis contract, stopping the flow of blood. The pressure decreases and the valves open, letting the blood flow out. Your penis loses its erection and becomes flaccid (soft).
The average length of an erect penis is about 5.1 inches (around 13 centimeters). How big your penis is when erect has nothing to do with the size of your penis when it’s soft. Some people with a smaller-than-average penis can have a longer-than-average erection and vice versa.
People most often associate erections with sex. But erections can happen without any sexual activity or when you’re asleep. Here are the three types of erections:
Erectile dysfunction (ED) happens when a person can’t get or keep an erection that’s hard enough for sexual intercourse. It’s a common condition that affects at least 10% of people.
A number of factors can cause ED, including:
Your healthcare provider may prescribe medication to help with ED. Some examples of oral medications include sildenafil (Viagra®), vardenafil (Levitra®) or tadalafil (Cialis®). If low testosterone is the cause of erectile problems, your provider may recommend testosterone therapy.
If medication doesn’t help, there are nonsurgical treatments like using a vacuum erection device (penis or penile pump) or getting penile injections. A suppository you put inside your penis can also be an option.
Be sure to discuss all treatment options with your healthcare provider so you can decide what method works best for you.
Several other nonsurgical treatments are currently being studied including focused low-intensity shockwave therapy. Another treatment called radial wave therapy has been shown to be ineffective for treating ED. At this time, these treatments aren’t FDA-approved for ED, and further research is needed.
An erection can last anywhere from a few minutes to a few hours. There isn’t really an average time for how long an erection should last. In general, though, the average amount of time a person has an erection during sexual intercourse before they ejaculate is about seven minutes.
Several factors can affect how long an erection lasts. Age, medications, stress or being under the influence of alcoholic beverages are examples of factors that influence an erection.
Go to the emergency room if you have an erection that lasts longer than four hours. An erection lasting longer than four hours is a condition known as priapism.
How you get and maintain an erection is extremely personal and unique to your body. It’s worth noting that erectile problems may occur as you age, or as you develop other health issues. Your healthcare provider can discuss your situation with you and develop a treatment plan if you feel your erections aren’t hard enough or don’t last long enough for enjoyable sex.
Generally speaking, though, there are some things you can do that help your erections. Examples include:
A note from Cleveland Clinic
There isn’t a one-size-fits-all solution to getting and maintaining an erection. The process starts in your brain and involves your nervous and circulatory systems. Being able to get and maintain an erection is important to your sexual and emotional health. ED can also be one of the first signs of a more serious issue like heart disease. Make an appointment with your healthcare provider if you’re concerned about your erections or are unable to get or maintain an erection. Treatment options are available to help you.
Last reviewed by a Cleveland Clinic medical professional on 04/06/2023.
Learn more about our editorial process.