Whenever you eat, carbohydrates in the foods you consume are broken down into blood sugar (glucose), which your body uses and stores for energy. To keep that blood sugar level under control, your body is supposed to produce the hormone insulin. But when you fail to make enough of this important hormone on your own because of type 1 or type 2 diabetes, insulin treatment is used to mimic your body’s natural blood sugar control.

As part of your insulin treatment, you may need to take insulin with food. This medication is called rapid-acting insulin. “These insulins, which are often used to manage blood sugar elevations related to food intake, are generally taken about 15 minutes or less before meals,” says Alison Massey, MS, RD, a certified diabetes educator in the Center for Endocrinology at Mercy Medical Center in Baltimore. “They start working about 10 to 15 minutes after you take them and have a three- to four-hour duration.”

Massey advises checking with your doctor for specific guidelines regarding your individual mealtime insulin regimen, including how many units you should take and at what times. To help you understand how best to take insulin with food, here are answers to common questions:

How does what I eat affect my insulin needs?

In general, the more a food raises blood sugar, the more insulin you’ll need to correct for that spike. And the higher the amount of carbohydrates in a food, the more that food will raise blood sugar.

“Protein-rich foods and fats — such as meats, poultry, seafood, nuts and seeds, butter, oils, and avocado — can slowly break down into glucose, but they still produce much less than high-carbohydrate foods,” Massey says. So the more food you eat and the higher the carbohydrate content of that food, the higher your insulin dose will need to be.

How can I adjust my insulin needs based on my blood sugar?

“The amount of insulin you need for each increment of blood sugar is very individual,” says Ann Williams, PhD, RN, a certified diabetes educator and a research associate professor at Case Western Reserve University in Cleveland, Ohio. “Work with your doctor to find the insulin dose that works best for you.” Most of the time, she says, the initial dosage calculation for insulin is based on weight, and then insulin treatment and blood sugar records are reviewed and fine-tuned by your doctor. The more accurately your mealtime insulin needs are calculated, the better.

If you give yourself a flat insulin dose, wait for your blood sugar to go up after eating, and then respond to the rise in blood sugar, Dr. Williams says, it’s not nearly as effective as an insulin treatment used to prevent the blood sugar from rising in the first place.

How can I plan my insulin dose when I don’t know what I will eat?

Typically this situation happens when you’re eating in a restaurant, Williams says. “From an ideal physiological sense, it would be best to time insulin with food throughout your meal, giving a separate injection for the carbohydrates in your appetizer, entree, and dessert,” she says. “But realistically, people don’t want to do that.”

Williams has more practical advice for planning mealtime insulin when dining is unpredictable. “I say make the best estimate of the total mealtime insulin you’ll need and give yourself half the insulin dose at the beginning of the meal,” she suggests. “Then, at the end of the meal, look back at what you ate and give the rest of the insulin dose based on that. If you ate less than you anticipated, take less than the remaining insulin dose. If you ate more, add a little more.”

Williams adds that an insulin pump, an insulin-delivering device that works throughout the day via a catheter, makes matching mealtime insulin to what you’ve eaten much easier. Once typically only used by people with type 1 diabetes, insulin pumps are becoming more popular among those with type 2. “I have type 2 diabetes and I use an insulin pump,” she says. “Insulin pumps provide maximum flexibility and control when it comes to timing insulin with food,” because you can add extra doses as needed without having to inject it.

How should I use insulin with snacks?

Depending on the type of snack you plan to eat, you may or may not need to take insulin before it. “Every person has a carbohydrate level that they can manage without insulin, and for most people, that level is about 10 to 15 grams of carbohydrates,” Williams says. “So if a snack contains less than 15 grams of carbs, you may not need to correct for it with insulin unless you’re extremely carbohydrate-sensitive.”

If you know you’ll be snacking later in the day, you can include a little extra insulin in your usual daily insulin dose. “For some people, however, this leads to low blood sugar,” Williams says. “So ideally, if you’re eating a snack that contains between 15 and 30 grams of carbohydrates, you should give yourself an injection with that snack rather than try to calculate for it ahead of time.” If you wear an insulin pump, you can add an extra insulin dose to it to cover the snack.

Overall, whether you use an insulin pump or don't, coming up with the best mealtime insulin doses for you is a very specific process that should be done with the help of your doctor. “Ideally, you want to prevent a blood sugar rise in the first place and then just use corrective insulin doses for fine-tuning,” Williams says.