Despite the negative press cholesterol often gets, this fatty substance isn’t entirely bad for you. Whether cholesterol is friend or foe to your health depends largely on the type and amount in your body.

Cholesterol is a fatty substance that travels through your blood. Your body makes some cholesterol, and the rest comes from foods you eat. You need some cholesterol to produce hormones and substances your body uses to digest foods. But too much of it can build up in your arteries and lead to a heart attack or stroke.

The kind of cholesterol you have matters, too. Low-density lipoprotein (LDL) cholesterol is nicknamed “bad” cholesterol because it can clog your arteries. High-density lipoprotein (HDL) cholesterol transports cholesterol to your liver, which removes it from your bloodstream. It’s like a drain cleaner for your arteries.

The ideal equation is to have high HDL and low LDL cholesterol. Knowing which foods are high in fat and cholesterol can help you make more heart-friendly dietary choices.

Cholesterol in your body comes from two main sources: your liver and your diet.

Your liver, other organs, and other cells in your body produce about 75 percent of the cholesterol in your blood.

The other 25 percent of cholesterol in your body is affected by the foods you eat. As you take in more cholesterol, your liver compensates by reducing its own production of cholesterol and removing excess cholesterol.

Not everyone makes and removes cholesterol with the same efficiency. Some people have genes that tell their liver to make extra cholesterol, or that slow their body’s cholesterol removal process. If you’ve inherited these genes, you may have high cholesterol even if you don’t eat foods that are rich in fat or cholesterol.

Foods that raise LDL cholesterol

Animal foods and products contain cholesterol, but it’s actually the types of fats in foods that can have a more dramatic effect on blood cholesterol levels. Decades of research has shown that saturated fats can raise your LDL and increase your risk for heart disease. Recent studies show a less clear link between saturated fat intake and risk for heart disease. However, a comprehensive meta-analysis found evidence that when saturated fat is replaced with polyunsaturated fats, not carbohydrates, heart disease risk decreases.

Foods that are high in saturated fats encourage your liver to make more LDL. You should limit these foods:

  • whole milk
  • ice cream
  • eggs
  • cheese
  • butter
  • red meat, including beef, veal, lamb, and pork
  • deli meats, sausage, bacon, and hot dogs

Foods that are high in trans fats also increase LDL cholesterol. These foods include:

  • cakes
  • cookies
  • crackers
  • fried foods
  • margarine
  • microwave popcorn

Foods that raise HDL cholesterol level

Other foods have a more positive effect on your cholesterol level. These foods decrease LDL cholesterol, while raising healthy HDL cholesterol:

  • fatty fish like salmon, sardines, herring, mackerel, and sea bass
  • tofu and other soy-based foods
  • flaxseeds
  • walnuts and other nuts
  • green leafy vegetables
  • foods high in soluble fiber, like oats, fruit, vegetables, and legumes

Read more: 11 foods to increase your HDL »

When you eat, cholesterol and fats from the food get broken down in your small intestine. They combine with bile salts, then lipases, and eventually get repackaged with other components before entering the bloodstream as lipoproteins.

Though some cholesterol components are stored in the liver and gallbladder, the main storage area for excess lipoproteins is in fat cells called adipocytes. When you have too much cholesterol, these cells swell up and you gain weight. Too much cholesterol can be caused by eating too much fat or carbohydrates.

Your body also uses some cholesterol to make bile, the greenish-brown fluid your liver produces to aid in food digestion. Bile is stored in your gallbladder.

Cholesterol isn’t entirely bad for you. In fact, your body uses it to make a few essential hormones, including:

  • sex hormones such as estrogen and progesterone in women, and testosterone in men, which help the sex organs develop and are involved in reproduction
  • cortisol, which helps your body respond to stress
  • aldosterone, which balances the number of minerals in your body
  • vitamin D, which helps your body absorb calcium to strengthen your bones

Cholesterol is also a component of bile, a substance your body needs to digest foods. And it’s used to build the membrane that surrounds cells.

Cholesterol becomes a problem when you have too much of the LDL type, and too little of the HDL type. LDL cholesterol builds up in arteries and forms a sticky goo called plaque. Over time, plaque hardens blood vessels, making them so rigid that less blood can flow through them. This is called atherosclerosis.

Learn more: Is reversing atherosclerosis possible? »

When your arteries are stiff, your heart has to work harder to force blood through them. Over time the heart can get so overworked that it becomes damaged. Plaques can also break apart, forming sticky clumps called clots.

If a clot breaks free it can travel to an artery that supplies blood to your heart. Once lodged in a blood vessel, the clot can cut off your heart’s blood supply and cause a heart attack. If a clot instead blocks a blood vessel that supplies your brain, you can have a stroke.

A 2013 update to cholesterol guidelines advises healthcare providers to look at more than just cholesterol levels. The update recommends taking into account other risk factors to more effectively treat and manage heart disease risk. The ideal cholesterol ranges that were previously recommended are:

Total cholesterol<200 mg/dL
LDL cholesterol<100 mg/dL
HDL cholesterol>60 mg/dL

Your doctor will likely still check your HDL, LDL, and total cholesterol levels with a blood test called a lipoprotein panel. If your cholesterol is high, you can start taking steps to lower it with diet, exercise, and possibly medicine.

If your cholesterol level is high, you may be able to successfully manage it with a few lifestyle changes.

  • Limit or cut out foods that are high in saturated and trans fats. Get no more than seven percent of your daily calories from foods like red meat, margarine, cookies, cake, and fried foods.
  • Replace unhealthy fats with heart-healthy, plant fats. Some sources of heart-healthy fats include avocados, nuts, seeds, and olive oil.
  • Get less than 200 milligrams of cholesterol daily by limiting high-cholesterol foods like whole milk, cheese, ice cream, and eggs.
  • Reduce intake of refined carbohydrates, like those made with white flour and added sugars. Studies show excess sugar intake can increase your risk for heart disease, diabetes, and metabolic disease.
  • Eat more plants like whole grains, fruits, vegetables, and legumes to increase your fiber and plant fats intake. These foods reduce the amount of LDL cholesterol in your bloodstream.
  • Increase the amount of fish in your diet. The omega-3 fatty acids in fish protect your heart.
  • Try to exercise every day. Aim for at least 30 minutes of aerobic exercise, five days a week.
  • If you smoke, talk to your doctor about smoking cessation programs to help you quit. Quitting smoking can dramatically improve your heart health.
  • Use diet and exercise to help you lose weight if you’re overweight.

If you try diet and exercise and they’re not enough to lower your cholesterol, you may need to take medicines. Cholesterol-lowering drugs include statins, bile acid sequestrants, nicotinic acid, and fibrates.

Learn more: Statins, safety, and cholesterol »