Hemorrhoids—the veins in your anal canal—are completely normal. It’s when they become swollen and inflamed when they become a problem. That’s what people generally mean when they say they have hemorrhoids.

And when hemorrhoids are acting up, they can certainly be uncomfortable. But how exactly they affect you depends on what type of hemorrhoid we’re talking about.

There are two types of hemorrhoids: External hemorrhoids are located under the skin around your anus, and can form a small, hard bulge there. They can also cause bleeding, painful swelling, and itching (While rare, bleeding in your poop can be serious—it's just one of the 7 signs of colon cancer in young men).

Internal hemorrhoids are found in your rectum—the lowest part of your large intestines—and usually aren’t painful. But they may cause bleeding that shows up in your stool, when you wipe, or in the toilet after you poop. You can also experience a prolapse, or when a hemorrhoid pops through your anal opening.

Hemorrhoids are common, but that doesn’t make them any more comfortable to deal with. While they can be easy to treat, playing the preventive game can be even better. But before you learn how to prevent hemorrhoids, you need to understand what causes hemorrhoids in the first place.

What Causes Hemorrhoids

There are lots of things you can do that can make symptomatic hemorrhoids more likely. And it all comes down to pressure overload on those veins.

For one, take your bathroom routine. Spending too much time on the toilet—say, you’re scrolling through your news feed—can be a huge trigger, says Anish Sheth, M.D., a gastroenterologist at the University Medical Center of Princeton in New Jersey. That’s because hemorrhoids can become enlarged and painful when there’s an increased pressure against the connective tissues that normally keep them in place.

Sitting on the toilet for long periods of time strains, irritates, and inflames those connective tissues, says Dr. Sheth. The same thing can happen if you’re constipated or if you sit in the same position at a desk or in a car (Here are 5 things you must try if you just can't poop).

Some men may even experience hemorrhoids if they lift heavy loads at the gym, says Dr. Sheth. You contract the same abdominals muscles as you do when you’re pooping, which can stress the tissues around your anus.

Your chances of getting hemorrhoids increase as you get older, too, says Dr. Sheth. The connective tissues lining your anal canal get weaker with age, allowing your blood vessels to bulge more easily when they’re irritated or stressed, he says.

How to Prevent Hemorrhoids

First, make your bathroom time into an express experience, says Mitchell Bernstein, M.D., Director in the Division of Colon & Rectal Surgery at NYU Langone Health. In fact, you shouldn't spend longer than 15 minutes on the toilet.

The longer you linger, the more pressure you’ll be exerting in your intra-abdominal region, he says. That can cause blood to pool in the veins in and around your rectum, leading to hemorrhoids.

Also, increase your water and fiber intake. Shoot for at least 25 grams of fiber per day from sources such as oatmeal, prunes, fruits, vegetables, and beans, says Dr. Sheth.

You’ve heard that directive before, and here’s just one more reason to focus on it. With that combo, your stools will become more pliable, shortening the time of transit through your digestive system, and also making it easier to poop.

That reduces or even eliminates the need for any straining or pushing when you’re on the toilet—an action that causes significant pressure on the veins and can lead to inflammation.

When your time to poop arrives—always a joyous event—don’t put it off. The longer you delay, the more water will be reabsorbed into the colon, making your stool harder to pass. That increases your chances of constipation and hemorrhoids.

How to Tell If Your Poop is Normal:

preview for How to Tell If Your Poop is Normal

Finally, keep moving. Being sedentary is connected to hemorrhoid problems, according to Robert Segal, M.D., founder and medical director of LabFinder. Exercising and just moving more in general reduces your time sitting, and also makes your digestive system work more efficiently (Here are 7 ways you wreck your body when you don't get off your butt).

When you do work out, build up your level of squats and leg presses gradually, rather than going from zero to squat master. Too many at one time can increase the intra-abdominal pressure, says Dr. Bernstein, in just the same way as straining to poop does.

How to Treat Hemorrhoids

The good news: Hemorrhoids aren’t hard to treat. Your first line of defense is to try an over-the-counter cream, ointment, or suppository that contains the steroid hydrocortisone. This hemorrhoid treatment drug helps reduce inflammation, pain, and itching.

“If your symptoms don’t clear up within about a week, make an appointment with your primary care doctor,” says Gina Sam, M.D., director of the Gastrointestinal Motility Center at the Mount Sinai Hospital. “You may need a prescription medication that contains a combination of hydrocortisone and lidocaine to better control your swelling and pain.”

Hemorrhoids still giving you pain? Ask your doctor to refer you to a gastroenterologist or proctologist. The specialists can treat severe cases of hemorrhoids or any complications, such as a blood clot, persistent bleeding, or a prolapse. In these scenarios, you may have to undergo a minimally invasive or surgical procedure to shrink your hemorrhoids.