ForHosting KIT · Home, food & hobbies

Scale recipe from ingredient on hand

Rewrite a recipe around the ingredient that is running out: with 200 g of flour left for a card that asks for 500 g, every line is multiplied by 0.4 and 250 g of butter becomes 100 g. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Amounts
500, 250, 2, 100
On hand
200
Limiting index
0
Names
flour (g), butter (g), eggs, sugar (g)
You get
Scaled
200, 100, 0.8, 40
Factor
0.4
Limiting name
flour (g)
Recipe amount
500

When the pantry is half empty, the useful question is not “how many servings do I want?” but “I only have this much flour left—how do I rewrite the whole card so nothing runs short?” Ratios stay fixed: half the flour still meets half the butter and half the eggs. Units are not converted—grams stay grams—so keep the same unit on the stock line and the recipe line.

What leftover scaling means and how the factor is built

Home cooks, meal-prep planners, and test kitchens often face a partial pantry: the card calls for five hundred grams of flour, but the bag holds two hundred. Scaling from leftover stock answers that constraint directly. You list every scalable amount in recipe order, mark which line is limiting—usually the scarce staple—and enter how much of that staple you still have.

If the card said five hundred grams of flour and two hundred fifty grams of butter, and you only have two hundred grams of flour, the factor is two hundred over five hundred equals zero point four, so butter becomes one hundred grams and every other line shrinks the same way. Optional name labels stay aligned with each amount so the response can echo flour, butter, and eggs next to the new figures and flag which line was the limiter.

This is different from a servings multiplier: you do not choose a target guest count first; the stock of one ingredient chooses the batch size for you.

Meal-prep from partial pantry stock

When only one staple is left in bulk, scale the full prep formula so that staple is fully used and every other line stays in ratio.

Is the leftover recipe scaler free?

The browser tool is free and runs locally.

How do I scale a recipe to the flour I have left?

List every amount in recipe order, mark flour as the limiting line and enter how much you still have. With 200 g left of the 500 g the card asks for, the factor is 0.4 and every other line is multiplied by it.

Does what I have need to be in the same unit as the recipe?

Yes. Units are not converted, so if the recipe gives flour in grams, enter your leftover flour in grams too. Cups on one side and grams on the other produce a wrong factor for every ingredient.

Why does the result say 0.8 eggs?

Eggs are scaled by the same factor as everything else: 2 eggs times 0.4 gives 0.8. The figure is kept exact instead of being rounded to whole eggs, so you decide how to handle it.

How is this different from scaling a recipe by servings?

With a servings scaler you choose the number of guests first. Here the stock of one ingredient sets the batch size for you, so that ingredient is used up and nothing else runs short.

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.

POSThttps://api.kit.forhosting.com/cook/leftover-scale

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.

curl -X POST https://api.kit.forhosting.com/cook/leftover-scale \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amounts":[500,250,2,100],"on_hand":200}'
{
  "amounts": [
    500,
    250,
    2,
    100
  ],
  "on_hand": 200
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "cook.leftover_scale",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

This leftover recipe scaler takes every numeric amount on your ingredient list, picks one limiting line (by index or by name), and multiplies the entire list by on_hand divided by that line’s recipe amount. Non-positive amounts and a non-positive on-hand stock are rejected with invalid_input instead of inventing a zeroed dish.

What leftover scaling means and how the factor is built

The solver computes a single shared factor equal to on_hand divided by the recipe amount on the limiting line, then multiplies every amount by that factor so relative ratios stay constant. Units are intentional not converted here—put grams or cups in both the recipe amount and on_hand so the ratio is dimensionless—and sibling cook converters can normalize cups to grams before you scale. Classroom worksheets and coding kata can assert the same rounded JSON because the arithmetic never depends on the clock or on external data.

How to call the API: fields, response shape, and errors

Prefer numbers rather than unit strings inside amounts; put units in the names field so two hundred fifty and flour (g) stay separate and readable in the ingredients array. Send a JSON body with amounts as a required array of finite positive numbers—or a comma-separated string on text forms—plus on_hand as the positive quantity of the limiting ingredient you actually have. Choose the limiting line with limiting_index (zero-based, default zero when omitted) or limiting_name matched case-insensitively against the optional names list; when both are set, the name match wins so scripts can identify flour without hard-coding positions. Names (aliases labels, ingredients) are optional parallel labels padded or truncated to the amount count. Absolute values stay within the published limit of one trillion, and the list length is capped so a Worker finishes quickly. On success the response echoes rounded amounts, scaled, factor, on_hand, limiting_index, limiting_name, recipe_amount on that line, count, names, ingredients rows with an is_limiting flag, formula, message, and ordered steps. Failed validation—empty amounts, non-finite numbers, any non-positive recipe amount, non-positive on_hand, an out-of-range index, or a limiting_name that does not match—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item.

Practical tips, related searches, and when to use another tool

Near-zero and negative values are rejected on purpose because a non-positive stock or recipe line cannot define a useful scale. This landing targets people searching for scale recipe by ingredient on hand, leftover limiting ingredient calculator, or recipe scale from pantry stock; it is not a unit converter, not a nutrition estimator, and not the servings-or-multiplier recipe scaler used when you already know the guest count. Prefer the sibling recipe scaler when you want factor two for a double batch, and prefer cups-to-grams tools when the card and the bag use different measures. Always keep on_hand and the limiting recipe amount in the same unit before you submit; mixing cups of flour with grams of stock produces a mathematically valid but kitchen-wrong factor. Prefer limiting_name when your list is stable and limiting_index when you build amounts programmatically without labels. If several ingredients are short, pick the true bottleneck—the line with the smallest on_hand over recipe ratio—or run the calculator once per candidate and take the minimum scaled batch. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately send zero stock. Round-trip checks are easy: recompute on_hand divided by the limiting recipe amount by hand, multiply each line, and confirm the published scaled entries match within twelve-decimal rounding, including that the limiting line’s scaled value equals on_hand after rounding.

Finish a half bag of flour or sugar

Paste the card amounts, set limiting_name to flour (g) and on_hand to what the bag still holds, then shop or mise en place from the scaled list.

Unit tests for kitchen calculator apps

Generate known-good scaled arrays and deliberate non-positive on_hand rejections for contract tests and coding kata expected values.

How does scaling a recipe from an ingredient on hand work?

Provide amounts, on_hand for the scarce line, and limiting_index or limiting_name. Factor = on_hand ÷ that recipe amount; every line is multiplied by the same factor.

What happens if on_hand or a recipe amount is zero or negative?

The tool returns invalid_input. Non-positive quantities cannot define a leftover scale and are rejected on purpose.

How is this different from a servings multiplier recipe scaler?

Servings mode chooses a guest count first. This tool lets the stock of one limiting ingredient choose the batch size via factor = on_hand ÷ recipe amount.

Does this convert cups to grams?

No. Keep units consistent on the limiting line and on_hand, or convert with a dedicated tool first, then scale the numbers here.

Read the full KIT documentation →