That midnight snack may not be worth it after all.

We've all had late nights when the thought of a peanut butter and jelly sandwich or a plate of cookies and milk seem like the perfect solution to getting a good night's sleep. But there are some foods that health experts say you should avoid — at least for your health.

Sarah Remmer, a registered dietician based in Calgary says depending on what you're eating and how quickly you eat it, certain foods have a harder time digesting when you are lying horizontally.

"Foods that are high in fat, fibre or protein are slower to digest. If someone were to eat eggs and bacon right before bed, they'll likely feel uncomfortable and won't be able to sleep. They may also feel full and bloated in the morning," she tells The Huffington Post Canada.

According to a May study by U.S. researchers on mice, eating late at night can make you gain a few extra pounds, according to The Daily Mail.

But Remmer says contrary to this popular belief, foods that you eat right before bed aren't directly stored as fat. "This is a myth. What matters when it comes to weight, is the total calories consumed in any given day, not the timing of these calories. So as long as someone stays within their recommended daily allowance of calories, weight gain or storage of fat will not occur," she says.

This also doesn't mean you have to ward off all foods before bed. Dietitian Leslie Beck says eating a light healthy snack or a big meal at least two to three hours before bed shouldn't hurt, according to the Globe And Mail. And Remmer suggests healthier food options like a glass of milk, a small handful of almonds, a bowl of yogurt and berries, or an apple with peanut butter.

Don't want to toss and turn as you try to sleep? Here are 11 things to avoid before bed:

Loading Slideshow...
  • Caffeinated Beverages And Foods

    You might want to skip that cup of joe before bed. "Caffeine is a stimulant and will over-stimulate your nervous system hindering sleep," says registered dietician Sarah Remmer.

  • Alcohol

    Drinking before bed? You may just get knocked out and dehydrated. Remmer says if you are having a few cups, you might wake up in the middle of the night feeling thirsty.

  • Spicy Food

    That burn in your mouth may last longer than you want it to. "These foods can produce an excess amount of stomach acid, therefore causing heartburn, bloating and discomfort which can disrupt sleep," she says.

  • Fried Foods

    Fried foods like French fries and potato chips are high in fat and take a longer time to digest. "It may take hours to fully digest fried foods. If you go to bed after eating fried foods, you will likely have trouble falling to sleep due to stomach pains, cramping and acid reflux," Remmer says.

  • Candy Or Foods High In Sugar

    Sugar is meant to give you an instant boost of energy -- so having a few pieces of candy isn't the best idea before bed.

  • Pop

    "These drinks are high in sugar, often contain caffeine and tend to bloat, produce gas, and cause acid reflux," Remmer says. Pop also doesn't have many nutritional values, so you may just end up waking up with a full bladder.

  • Ice Cream

    Having a girls night in? Having a small bowl of low-fat yogurt or milk before bed won't do any harm. But if you have a giant bowl of chocolate chip ice cream, you can forget about getting a good night's sleep. "Ice cream contains high amounts of fat which is digested at a slow rate. It also contains a lot of sugar which can keep you up," Remmer says.

  • Red Meat

    Read meat is high in protein and also tends to be high in fat. "Both protein and fat are slowly digested, so this meat will stay in your stomach for quite a while before it is digested fully, causing discomfort and even cramping," she says.

  • Chili

    Chili that has beans, meat and tomato sauce is a recipe for disaster before bed. "Beans are gas-producing, red meat is high in fat and tomato sauce may cause acid reflux. A perfect storm for a not-so-sound sleep."

  • Most Veggies

    Most vegetables -- especially broccoli, cabbage, onions and cauliflower are high in insoluble fibre which moves slowly in your digestive system. "These vegetables make you full longer but also contain gas-producing qualities," Remmer says.

  • Oats

    Have the oatmeal in the morning, not before bed. Oatmeal, bran buds and barley are all high in insoluble fibre, which again can slow down digestion and cause gas.

Caffeinated Beverages And Foods:
You might want to skip that cup of joe before bed. "Caffeine is a stimulant and will over-stimulate your nervous system hindering sleep," says registered dietician Sarah Remmer.

Alcohol:
Drinking before bed? You may just get knocked out and dehydrated. Remmer says if you are having a few cups, you might wake up in the middle of the night feeling thirsty.

Spicy Food:
That burn in your mouth may last longer than you want it to. "These foods can produce an excess amount of stomach acid, therefore causing heartburn, bloating and discomfort which can disrupt sleep," she says.

Fried Foods:
Fried foods like French fries and potato chips are high in fat and take a longer time to digest. "It may take hours to fully digest fried foods. If you go to bed after eating fried foods, you will likely have trouble falling to sleep due to stomach pains, cramping and acid reflux," Remmer says.

Foods With A Lot Of Sugar:
Sugar is meant to give you an instant boost of energy — so having a few pieces of candy isn't the best idea before bed.

Pop:
"These drinks are high in sugar, often contain caffeine and tend to bloat, produce gas, and cause acid reflux," Remmer says. Pop also doesn't have many nutritional values, so you may just end up waking up with a full bladder.

Ice Cream:
Having a girls night in? Having a small bowl of low-fat yogurt or milk before bed won't do any harm. But if you have a giant bowl of chocolate chip ice cream, you can forget about getting a good night's sleep. "Ice cream contains high amounts of fat which is digested at a slow rate. It also contains a lot of sugar which can keep you up," Remmer says.

Red Meat:
Read meat is high in protein and also tends to be high in fat. "Both protein and fat are slowly digested, so this meat will stay in your stomach for quite a while before it is digested fully, causing discomfort and even cramping," she says.

Chili:
Chili that has beans, meat and tomato sauce is a recipe for disaster before bed. "Beans are gas-producing, red meat is high in fat and tomato sauce may cause acid reflux. A perfect storm for a not-so-sound sleep."

Most Veggies:
Most vegetables — especially broccoli, cabbage, onions and cauliflower are high in insoluble fibre which moves slowly in your digestive system. "These vegetables make you full longer but also contain gas-producing qualities," Remmer says.

Oats:
Have the oatmeal in the morning, not before bed. Oatmeal, bran buds and barley are all high in soluble fibre, which again can slow down digestion and cause gas.

Also on HuffPost: