Medically Reviewed by Jabeen Begum, MD on April 25, 2024
9 min read

Epididymitis is inflammation of the epididymis – a long, coiled tube at the back of the testes. Anyone with testicles and an epididymis can get this condition. It’s usually caused by bacteria, like the kind that cause sexually transmitted infections, but you can get epididymitis for other reasons.

What does the epididymis do?

The epididymis stores and carries sperm from the testes, which produce it, to the vas deferens, a tube behind the bladder. 

The epididymis lies in coils around the back of a person’s testicle and can be nearly 20 feet long.

It can take nearly 2 weeks for sperm to make it from one end of the epididymis to the other. In that time, the sperm cells mature to the point where they could reach an egg (inside someone who has a uterus) and fertilize it.

When a bacterial infection strikes, the epididymis gradually becomes swollen and painful. This usually happens on one testicle, rather than both. It can last up to 6 weeks if untreated.

You might have one or more of these other possible symptoms:

  • Redness, swelling, or tenderness in the scrotum, the sac that contains the testes
  • A more frequent or urgent need to pee
  • Painful urination or ejaculation
  • Fever
  • Bloody urine
  • Discomfort in your lower abdomen
  • Enlarged lymph nodes in your groin
  • A lump on your testicle

See your doctor if you have any of these symptoms.

Acute epididymitis 

This is when your inflammation or infection lasts less than 6 weeks. Symptoms usually come on slowly over the course of 1-2 days. The main thing you’ll notice is pain in your scrotum, but your whole testicle or nearby areas may hurt. The skin around your testicle may be swollen, red, hard, or warm.

Chronic epididymitis 

This is when you have inflammation that comes and goes or lasts longer than 6 weeks. The inside of your scrotum may hurt, but you shouldn’t have any swelling, redness, or warmth. You may need treatment with antibiotics, or the inflammation may go away on its own.

You may get chronic epididymitis for unknown reasons or after a bout of epididymitis, but these flares tend to be less serious than acute episodes.

Pediatric epididymitis

Kids can also get epididymitis. A sexually transmitted infection, urinary tract infection, or a physical problem in the urinary and reproductive organs can cause the condition. Symptoms in children are similar to those in adults:

  • Testicle pain and swelling
  • Fever
  • A heavy feeling in your testicles
  • Leaking fluid from the urethra
  • Blood in your semen
  • A lump in your testicles
  • Pain while peeing or during ejaculation

Conditions with the same symptoms

Epididymitis shares many of the symptoms of other problems that can affect your testicles. This includes:

Testicular torsion. This is when a testicle gets turned around and twists itself around the cord that connects it to the body. Testicular torsion symptoms usually develop much faster than epididymitis. It’s a medical emergency. You may lose a testicle if you don’t get treatment quickly.

Epididymo-orchitis. This happens when the swelling and tenderness extend past the epididymis and into the testicle itself.

Epididymal hypertension. Sometimes called “blue balls,” this is when you have pain in your scrotum after you get an erection but don’t get the chance to ejaculate. It’s not dangerous and usually goes away in a few minutes or hours. 

Testicular cancer. A tumor can sometimes cause swelling or pain in your scrotum. 

About 600,000 cases of epididymitis are reported in the United States every year, mostly in people assigned male at birth between the ages of 14 and 35. But males of any age can get it.

People usually get epididymitis because of a bacterial infection. This commonly includes germs that cause sexually transmitted infections, such as gonorrhea and chlamydia. But the most likely cause of epididymitis largely depends on your age.

Can you get epididymitis without having an STD?

Yes. Other causes of epididymitis include:

Urinary tract or bladder infections. Bacteria can spread from your urinary system to your testicles. This is the most common cause of epididymitis in people who have a penis who are older than 35.

Other infections. Viruses and bacteria can spread from other parts of your body (like your prostate) to the area around your testicles. Rarely, the bacteria that causes tuberculosis can cause epididymitis. 

Reverse urine flow. Chemicals in your pee can be irritating if they reach your epididymis. This may happen if something blocks urine from leaving your urethra or your pee flows backward for another reason – like you lift something heavy and put strain on your urinary system.

Anal sex. E. coli and similar bacteria can spread from the anal canal to your penis. 

You can also get: 

Traumatic epididymitis. Your testes can get inflamed if something hits you in the testicles. Symptoms due to trauma will be similar to epididymitis that happens for other reasons, such as from an infection.

Epididymitis after a vasectomy. This is a medical procedure that results in permanent birth control for people who make sperm. Around 4% of people who get this minor surgery can get an infection or swelling in the epididymis afterward.

When you get epididymitis due to a vasectomy, your doctor will likely give you antibiotics to clear up the infection. 

Tell your partners

If your condition is the result of a sexually transmitted infection, mention your diagnosis to anyone you’ve been sexually active with in the past 60 days.

If you haven’t been sexually active for longer than 2 months, it’s still a good idea to let your most recent sex partner know about your STI so they can get tested.

Your chances of having epididymitis rise if you have:

  • Unprotected sex with someone who has a sexually transmitted infection (STI)
  • A history of STIs
  • A history of infections in your prostate or urinary tract
  • A history of procedures that impact your urinary tract
  • An uncircumcised penis
  • An enlarged prostate

Other possible risk factors include: 

  • Having a urinary catheter or scope put into your penis
  • Infection with tuberculosis or mumps
  • Structural differences in your urinary tract
  • Having a health condition that weakens your immune system

Epididymitis and masturbation

You won’t make your condition worse if you ejaculate, but masturbation will probably hurt. Ask your doctor what physical activities are safe, but they’ll likely suggest you hold off on masturbation until you’re treated and your symptoms get better.

When you go to the doctor, they will examine your scrotum for signs of infection and ask you questions about your symptoms. They might also do a rectal exam to check your prostate and check for any tenderness.

If your doctor suspects epididymitis based on the exam, you might get one or more tests. They include:

  • Urine sample: You may pee into a cup so a lab can check for signs of an infection.
  • Blood sample: This can also find abnormalities or high levels of inflammation in your blood.
  • Swab sample: For this test, your doctor inserts a narrow swab into the tip of your penis to get a sample of discharge. This is used to test for chlamydia or gonorrhea.

Epididymitis ultrasound

You might also be asked to sit for an ultrasound test, which uses sound waves to produce an image of your scrotum and testicles. If you get one that uses color (Doppler), this can show whether you have abnormal blood flow.

Your doctor can use an ultrasound test to check for epididymitis along with other health problems, including testicular torsion and testicular cancer.

During an ultrasound for epididymitis, a health care professional will: 

  • Ask you to lie back with your legs open
  • Lift your scrotum
  • Put a clear gel on your scrotal sac
  • Gently scan your scrotum with a special device

A scrotal ultrasound should be painless, and you won’t have to do anything special to prepare for it.

Your treatment depends on what’s causing your symptoms and how serious your condition is. You may need rest, medication, or other measures to lessen your pain and swelling. Surgery may be needed in some cases. 

Treatment for epididymitis may include: 

Epididymitis medication

The most common treatment for epididymitis is antibiotics. If your doctor believes you have epididymitis, they might give you a prescription for antibiotics before any lab test results are even back.

The type of medication you’ll need depends on the bacteria behind your infection. Common antibiotics for epididymitis include: 

  • Ciprofloxacin
  • Doxycycline
  • Levofloxacin
  • Trimethoprim-sulfamethoxazole

If your infection is serious (or you throw up a lot), you may need antibiotics through a vein in your arm. You’ll get this kind of treatment in a hospital. 

Over-the-counter or home remedies for epididymitis

To ease pain and swelling, your doctor may suggest you:

  • Rest while lying down.
  • Take over-the-counter pain relievers like nonsteroidal anti-inflammatory drugs (NSAIDs).
  • Apply a cold compress.
  • Elevate your scrotum with supportive underwear, like a jockstrap.

Surgery for epididymitis

You may need surgery to drain any pus-filled tissue (abscesses). In some cases, your doctor may need to take out all or part of your epididymis (epididymectomy). If you have urinary tract abnormalities, surgery may be able to fix the problem that’s causing epididymitis. 

Epididymitis recovery time

If you have epididymitis because of an infection, you’ll probably start to feel better within a few days after you start your antibiotics. Even after your antibiotics take effect, some swelling may last for weeks or months, and you may still be sore during that time

During your recovery, you should: 

  • Finish all your antibiotics, even if you start to feel better. 
  • Avoid lifting heavy things.
  • Take a break from sex (or masturbation) until your infection is gone.

Epididymitis can cause a number of medical problems, particularly if it goes untreated. Here are some examples of complications of epididymitis: 

  • Chronic epididymitis. Infection or inflammation comes and goes or lasts more than 6 weeks
  • Epididymo-orchitis. When your infection spreads to a testicle
  • Abscess. An infected pus-filled sac that forms inside your scrotum
  • Hydrocele. Fluid that collects in the sac around the testicle. Usually painless. 

Rarely, epididymitis can lead to infertility (trouble getting someone pregnant). This may happen if an infection clogs the epididymis (sperm duct blockage) or you make less sperm because a testicle shrinks. Ask your doctor if this might happen to you.

Any serious infection might lead to a life-threatening condition called sepsis. This happens when your immune system has a strong reaction to fighting germs. Your odds of sepsis are higher if you have a chronic medical condition, you’re older than 65, or you have a weakened immune system. 

Call 911 or get medical help right away if you or your loved one with epididymitis has: 

  • A fast heart rate or weak pulse
  • Confusion
  • Trouble breathing
  • Fever or shivering
  • Sweating or clammy skin
  • Serious pain

You may not be able to prevent epididymitis, but there are some steps to lessen the chances you’ll get it. They include:

  • Use condoms when you have sex.
  • Try not to sit for long periods. 
  • Be careful not to strain if you lift heavy things.
  • Treat any infections that may spread to your epididymis.

If you get urinary tract or bladder infections often, ask your doctor if there are other steps you can take to reduce your risk of epididymitis. 

Epididymitis is when you get inflammation of your epididymis (a coiled tube on the back of your testicles). It’s usually caused by a bacterial infection and goes away with antibiotics. But your treatment depends on what’s causing your symptoms in the first place. 

Practice safer sex, such as using a condom, to lessen the chances you’ll get a sexually transmitted infection that may lead to epididymitis. Ask your doctor what other steps you can take to lower your risk.

What is the main cause of epididymitis?

Bacterial infections are behind most cases of epididymitis. This commonly includes sexually transmitted infections such as gonorrhea and chlamydia, but also germs that cause urinary tract, bladder, or prostate infections. Some viruses can also trigger inflammation in your epididymis.

Does epididymitis go away on its own?

It depends on what’s causing the inflammation. Epididymitis may go away on its own if your doctor can’t find its cause, but you’ll need antibiotics if you have a bacterial infection. Sometimes, you may need surgery. 

What does epididymitis feel like?

It can be really painful. Your scrotum may be tender, swollen, red, or warm. It may hurt when you pee, and you may feel like you need to pee more often. Your lower belly or pelvic area may ache, and you could feel sick to your stomach or throw up.