Recipe total cost calculator
The recipe total cost calculator adds up what every ingredient contributes to a dish.
Run — free
Enter the quantity you actually use and the price for one matching unit, and it multiplies those values before summing the complete recipe. This is useful when a package price alone does not reveal the cost of the portion used. The calculation is deterministic, transparent, and suitable for home budgets, catering estimates, bakery worksheets, menu planning, or automated costing through the API.
Prepare quantities and prices that use matching units
For each ingredient, enter the quantity used in the recipe and the price of one unit. The two values must describe the same unit. If a recipe uses 0.5 kilograms of flour, the unit price should be the price per kilogram; if it uses four eggs, the unit price should be the price per egg. Convert package prices before entering them when necessary. For example, a 2-kilogram bag costing 6 has a unit price of 3 per kilogram. Ingredient names are optional, but clear names make the returned line items easier to review and save with a costing sheet. Quantities and unit prices may be zero, which is helpful for water, donated goods, or pantry items you intentionally treat as having no cost. Negative values and values that are not finite numbers are rejected because they cannot represent an ordinary ingredient quantity or price. Use one currency consistently across every row; the calculator performs arithmetic and does not convert currencies or infer units from names.
Understand how the recipe total is calculated
Each line cost is calculated as quantity multiplied by unit price. The recipe total is the sum of all those line costs. Suppose a dough uses 1.5 kilograms of flour at 1.20 per kilogram, four eggs at 0.35 each, and 0.25 kilograms of butter at 6.40 per kilogram. Those rows contribute 1.80, 1.40, and 1.60, so the full recipe costs 4.80 in the currency you used. The response includes the normalized quantity, unit price, and calculated cost for every ingredient, followed by the total and a plain formula. This line-by-line output makes it straightforward to identify an expensive ingredient or verify the result independently. Arithmetic is rounded consistently to keep JSON results stable across environments while retaining enough precision for ordinary recipe costing. The function has no network calls, price database, random behavior, or time-dependent logic, so identical valid inputs always produce identical outputs.
Use the result in budgeting and production decisions
The total represents ingredient usage for the whole recipe, not the amount paid at checkout and not a recommended selling price. A package may cost more than the portion consumed because some remains for another batch. Likewise, the result does not automatically include labor, energy, packaging, delivery, waste, tax, overhead, or profit. Add those costs in your broader pricing workflow when they matter. For repeated production, store your normalized unit prices and update them when supplier prices change, then run the same recipe again to see the effect. You can also compare alternative formulations by changing one quantity or unit price while keeping the other rows fixed. The browser calculator is convenient for a quick estimate, while the API costs $0.002 per request and supports reproducible costing inside inventory tools, order forms, and menu systems. Always label the currency and unit convention in the surrounding record, since the numerical result deliberately remains currency-neutral and unit-neutral.
What you can do with it
Cost a bakery batch
Multiply the amount of flour, butter, sugar, and other ingredients used by their normalized unit prices before setting a batch budget.
Compare recipe variations
Change one ingredient quantity or supplier unit price and compare the resulting total with the original formulation.
Automate menu costing
Send structured ingredient rows through the API and store a deterministic recipe total in a kitchen or catering workflow.
FAQ
What does one calculation cost?
The API price is $0.002 per request. The calculator can also run free in your browser.
How is each ingredient cost calculated?
Each line cost is its quantity multiplied by its unit price. All line costs are then added to produce the recipe total.
Do quantity and unit price need matching units?
Yes. A quantity in kilograms needs a price per kilogram, while a quantity counted as individual items needs a price per item.
Can I enter negative values or text instead of numbers?
No. Quantities and unit prices must be finite numbers that are zero or greater; negative and non-numeric inputs return an invalid input error.
Does the total include labor, overhead, or profit?
No. It totals only the ingredient usage supplied in the request. Add labor, packaging, waste, tax, overhead, and margin separately when needed.
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/cook/recipe-cost \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"ingredients":[{"name":"Flour","quantity":1.5,"unit_price":1.2},{"name":"Eggs","quantity":4,"unit_price":0.35},{"name":"Butter","quantity":0.25,"unit_price":6.4}]}'const res = await fetch("https://api.kit.forhosting.com/cook/recipe-cost", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"ingredients": [
{
"name": "Flour",
"quantity": 1.5,
"unit_price": 1.2
},
{
"name": "Eggs",
"quantity": 4,
"unit_price": 0.35
},
{
"name": "Butter",
"quantity": 0.25,
"unit_price": 6.4
}
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/cook/recipe-cost",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"ingredients": [
{
"name": "Flour",
"quantity": 1.5,
"unit_price": 1.2
},
{
"name": "Eggs",
"quantity": 4,
"unit_price": 0.35
},
{
"name": "Butter",
"quantity": 0.25,
"unit_price": 6.4
}
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/cook/recipe-cost", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"ingredients":[{"name":"Flour","quantity":1.5,"unit_price":1.2},{"name":"Eggs","quantity":4,"unit_price":0.35},{"name":"Butter","quantity":0.25,"unit_price":6.4}]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"ingredients":[{"name":"Flour","quantity":1.5,"unit_price":1.2},{"name":"Eggs","quantity":4,"unit_price":0.35},{"name":"Butter","quantity":0.25,"unit_price":6.4}]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/cook/recipe-cost", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"ingredients": [
{
"name": "Flour",
"quantity": 1.5,
"unit_price": 1.2
},
{
"name": "Eggs",
"quantity": 4,
"unit_price": 0.35
},
{
"name": "Butter",
"quantity": 0.25,
"unit_price": 6.4
}
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "cook.recipe_cost",
"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.
Limits
min_ingredients | 1 |
max_ingredients | 200 |
max_value | 1000000000000 |
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. |