Rule of three calculator
The rule of three calculator finds one unknown value from three known values in a proportional relationship.
Run — free
Choose direct proportion when both quantities increase or decrease together, or inverse proportion when one rises as the other falls. Enter the known values as a, b, and c, and the calculator solves x using a:b = c:x for direct proportion or a×b = c×x for inverse proportion. The result is deterministic, requires no rounding settings, and clearly rejects a zero value when that value would be used as a divisor.
Arrange the three known values before calculating
A rule of three works only when corresponding quantities occupy matching positions, so the most important step is arranging the values correctly. Treat a and b as the first complete pair. Then place c in the same position as a within the second pair, leaving x in the position corresponding to b. For a direct relationship, the calculator reads that arrangement as a:b = c:x and computes x = b×c÷a. Imagine four notebooks cost ten currency units and you want the cost of six notebooks: a is 4, b is 10, and c is 6. Because cost increases with quantity, direct proportion applies. Units can differ between the two positions, but a and c must describe the same kind of quantity, while b and x must describe the other kind. Write the labels beside the numbers before entering them. This small check prevents the common mistake of swapping c with b and obtaining a numerically valid result that answers a different question.
Choose direct or inverse proportion from the relationship
Use direct proportion when multiplying one quantity by a factor multiplies the paired quantity by that same factor. Price and quantity at a constant unit price, distance and travel time at constant speed, and recipe ingredients and serving counts are familiar examples. Use inverse proportion when multiplying one quantity by a factor divides the paired quantity by that factor. Workers and completion time for a fixed job, speed and travel time over a fixed distance, or machines and production duration under equal output rates often follow this pattern. Do not decide from whether the values happen to look larger or smaller in one sample; decide from what must remain constant. In the direct form, the ratio b÷a remains constant. In the inverse form, the product a×b remains constant. The calculator therefore solves inverse cases with x = a×b÷c. Real situations can include setup time, changing rates, or bulk discounts, so confirm that proportionality is a reasonable model before relying on the answer.
Interpret the result and handle zero safely
The returned value is the fourth term x, accompanied by the selected relationship so automated callers can retain the calculation context. A direct calculation divides by a, while an inverse calculation divides by c. If that required divisor is zero, the operation is undefined and the calculator returns an invalid-input error instead of Infinity or a misleading number. Zero is allowed in a position that is not the divisor: for example, b = 0 in a direct proportion produces x = 0. Every supplied value must be a finite number, which excludes missing fields, numeric text, Infinity, and NaN from API use. Extremely large combinations that overflow the finite number range are also rejected. For practical results, keep the units attached when you copy the value because the numeric output itself does not invent a unit. The browser version is convenient for individual calculations, while API calls cost $0.002 per request and suit worksheets, quoting tools, educational checks, and repeatable business workflows.
What you can do with it
Scale a recipe
Find the required amount of an ingredient when the serving count changes in direct proportion.
Estimate job duration
Calculate completion time when the number of equally productive workers changes in inverse proportion.
Automate proportional quotes
Compute a price or material quantity from a known reference pair inside a repeatable API workflow.
FAQ
What is the rule of three?
It is a method for finding a fourth proportional value from three known values by preserving either a ratio for direct proportion or a product for inverse proportion.
How are a, b, c, and x arranged?
For direct proportion, enter values so a:b = c:x. For inverse proportion, a and b form one pair and c and x form the other, with a×b = c×x.
How do I know whether the proportion is direct or inverse?
Choose direct when both paired quantities change by the same factor in the same direction. Choose inverse when increasing one by a factor decreases the other by that factor.
Why is zero sometimes rejected?
Direct proportion divides by a, so a cannot be zero. Inverse proportion divides by c, so c cannot be zero. Other zero values are accepted when the formula remains defined.
Does the calculator preserve units?
It calculates the numeric value only. The result has the unit used by b in a direct setup or the corresponding unknown quantity in the inverse setup, so keep your labels with the inputs.
What does an API request cost?
Each API request costs $0.002. The same deterministic calculation can also run free in the browser.
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/calc3/rule-of-three-solve \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"relation":"direct","a":4,"b":10,"c":6}'const res = await fetch("https://api.kit.forhosting.com/calc3/rule-of-three-solve", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"relation": "direct",
"a": 4,
"b": 10,
"c": 6
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/calc3/rule-of-three-solve",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"relation": "direct",
"a": 4,
"b": 10,
"c": 6
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/calc3/rule-of-three-solve", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"relation":"direct","a":4,"b":10,"c":6}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"relation":"direct","a":4,"b":10,"c":6}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/calc3/rule-of-three-solve", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"relation": "direct",
"a": 4,
"b": 10,
"c": 6
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "calc3.rule_of_three_solve",
"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. |