Net carbs calculator
25 g of total carbohydrate with 8 g of fiber and 5 g of sugar alcohols leaves 12 g of net carbs. Copy the three numbers from the label and get the grams that count toward your keto or low-carb budget. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Total carbs
- 25
- Fiber
- 8
- Sugar alcohols
- 5
- Net carbs
- 12 g
Net carbohydrates are the digestible carb grams many low-carb, keto, and diabetic meal plans track after removing fiber and sugar alcohols from the total carbohydrate line on a nutrition label. Reading three numbers and doing the subtraction by hand is easy for one snack and error-prone for a full day of packaged foods, restaurant macros, and spreadsheet imports.
What net carbs are and how they are worked out
On a US-style nutrition facts panel, total carbohydrate is the umbrella number. It usually includes dietary fiber, sugars and, when present, sugar alcohols. Many low-carb, keto and diabetic meal plans count only the carbohydrate the body digests, so they remove fiber, which is largely non-digestible, and sugar alcohols, which are only partly metabolized. What remains are net carbs. The arithmetic is a simple subtraction on grams for one serving: 25 g of total carbohydrate minus 8 g of fiber minus 5 g of sugar alcohols leaves 12 g.
Common mistakes when counting net carbs
Doing the subtraction by hand is easy for one snack and error-prone for a full day of packaged foods and restaurant meals. Keep all three numbers from the same serving size, or the result will not match what you eat. If fiber and sugar alcohols together add up to more than the total, a value was copied wrong. Fiber or sugar alcohols can be zero when the label lists none. The calculator does not look up products, estimate glycemic index or apply half-counts for particular sugar alcohols, so apply any such rule from your own plan yourself.
What net carbs mean and how the formula is applied
On a United States style nutrition facts panel, total carbohydrate is the umbrella number that usually includes dietary fiber, sugars, and often sugar alcohols when they are present. Many low-carb and ketogenic programs treat fiber as largely non-digestible and treat sugar alcohols as only partly metabolized, so they compute net carbs by subtracting those two lines from total carbohydrate. Total carbohydrate must be a finite positive number because a non-positive total is not a useful serving amount for net-carb tracking and would only produce zero or nonsense after subtraction.
Fiber and sugar alcohols must be finite and non-negative; zero is allowed when the label lists none.
What you can do with it
Daily keto or low-carb meal logging
Convert each food’s total carbs, fiber, and sugar alcohols into net grams and sum them against a daily net-carb budget.
Recipe and meal-prep scaling
Scale label macros for batch recipes, then recompute net carbs per serving with the same formula for every portion size.
FAQ
What if fiber or sugar alcohols are zero?
Use 0 for any line the label omits.
Does the calculator subtract only half of the sugar alcohols?
No. It subtracts the full sugar alcohol amount shown on the label. If your plan counts only half of certain sugar alcohols, halve that number before entering it, or adjust the net result afterwards.
What if fiber plus sugar alcohols is more than the total carbs?
The calculator stops and asks you to check the numbers instead of showing a negative result, because that combination cannot come from a consistent label. Usually one value was copied from the wrong line or serving.
Why are fiber and sugar alcohols subtracted at all?
Many low-carb and ketogenic programs treat fiber as largely non-digestible and sugar alcohols as only partly metabolized. That is why they leave both out of the carbohydrate grams that count against the daily budget.
How do I track net carbs for a whole day?
Work out the net grams for each food or serving you eat, then add them up and compare the sum with your daily net-carb budget. For batch recipes, scale the label values first and recompute per portion.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/health/net-carbs \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"total_carbs":25,"fiber":8,"sugar_alcohols":5}'const res = await fetch("https://api.kit.forhosting.com/health/net-carbs", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"total_carbs": 25,
"fiber": 8,
"sugar_alcohols": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/health/net-carbs",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"total_carbs": 25,
"fiber": 8,
"sugar_alcohols": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/health/net-carbs", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"total_carbs":25,"fiber":8,"sugar_alcohols":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"total_carbs":25,"fiber":8,"sugar_alcohols":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/health/net-carbs", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"total_carbs": 25,
"fiber": 8,
"sugar_alcohols": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "health.net_carbs",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This net carbs calculator accepts total carbohydrate grams, dietary fiber grams, and sugar alcohol (polyol) grams, then returns a deterministic net_carbs value with the formula restated for display. Invalid or non-positive total carbohydrate, negative fiber or polyols, and impossible label combinations where fiber plus sugar alcohols exceed total carbs fail with invalid_input instead of inventing a negative result.
What net carbs mean and how the formula is applied
The arithmetic is deliberately simple: net_carbs equals total_carbs minus fiber minus sugar_alcohols, with every quantity expressed in grams for one serving or one food entry. This endpoint implements that consumer convention exactly, without estimating glycemic index, without converting units, and without guessing missing label fields. If fiber plus sugar alcohols exceeds total carbohydrate, the combination cannot come from a consistent label, so the task fails with invalid_input rather than returning a negative net value that would confuse logs and dashboards.
Input contract, response shape, and error behaviour
Example: twenty-five grams total carbohydrate, eight grams fiber, and five grams sugar alcohols yields twelve grams of net carbs. Failed validation is not billed. The capability does not look up products, scrape databases, or adjust for brand-specific half-counts of certain polyols; if your protocol subtracts only half of sugar alcohols, apply that factor before calling or after receiving the raw net figure. POST a JSON body with three required fields: total_carbs, fiber, and sugar_alcohols. Each may arrive as a JSON number or as a numeric string; booleans, empty strings, NaN, and Infinity fail with invalid_input naming the field. Aliases are accepted for transport convenience: carbs, carbohydrate, total_carbohydrate, carbohydrate_g, and carbs_g map to total_carbs; fiber_g, dietary_fiber, fibre, and fibre_g map to fiber; sugar_alcohols_g, polyols, polyol_g, and sugar_alcohol map to sugar_alcohols. On success the body echoes the cleaned total_carbs, fiber, and sugar_alcohols values, the computed net_carbs, a short formula string, and unit set to g. Example with no polyols: forty grams total, ten grams fiber, zero sugar alcohols yields thirty grams net. Pair the result with your own diary UI, barcode cache, or recipe scaler; this endpoint only performs the gram arithmetic.
Where a net carbs calculator earns its keep
Meal-planning apps and keto coaches use a net carbs calculator so users can paste label numbers and stay under a daily net-carb budget without spreadsheet mistakes. Restaurant and delivery aggregators normalize vendor macros into net carbs for filters such as under ten net grams, which requires a single deterministic function instead of ad-hoc client code in every platform. Continuous glucose and diabetes education tools often teach label reading by showing total versus net side by side; a shared API keeps the classroom demo and the production backend identical. Keep requests small, pin expected net_carbs in tests, and you get reproducible results for mobile clients, serverless workers, and batch importers without standing up a nutrition database of your own.
Integration use cases
Product filters and coaching dashboards
Normalize catalog macros to net_carbs so apps can filter snacks under a net-gram threshold and coaches can audit client logs.
Technical questions
How do you calculate net carbs?
Send total_carbs, fiber, and sugar_alcohols in grams. The API returns net_carbs = total_carbs − fiber − sugar_alcohols using the standard consumer label formula.
Why can the request fail when numbers look plausible?
If fiber plus sugar_alcohols exceeds total_carbs, the combination is inconsistent with a single label total and the task fails with invalid_input.
Does this adjust for half of sugar alcohols?
No. The endpoint always subtracts the full sugar_alcohols amount. Apply any half-count or brand-specific rule before or after the call if your protocol requires it.
What does the net carbs calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.