ForHosting KIT · Science

Alligation calculator

Reaching 50% from an 80% stock and a 30% stock takes 20 parts of the first and 30 of the second, a 2:3 ratio, or 40% and 60% of the blend. Enter all three strengths in the same unit. 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
C1
80
C2
30
Target
50
You get
Parts1
20
Parts2
30
Ratio
2:3
Ratio parts1
2

Alligation is the classic pharmacy and chemistry method for finding how much of two solutions of different strengths you must combine to hit a target concentration. Given the concentration of the first solution, the concentration of the second, and the desired mixture strength, alligation alternate returns the ratio of parts of each stock. Parts of the first solution equal the absolute difference between the target and the second concentration; parts of the second equal the absolute difference between the first concentration and the target.

How alligation alternate finds the mixing ratio of two strengths

Alligation alternate is the criss-cross construction taught in pharmacy compounding and general chemistry when two stocks of the same solute must be blended to a labeled intermediate strength. Write the higher concentration above the lower one and place the target in the middle. The number of parts of the stronger stock is the absolute difference between the target and the weaker concentration; the number of parts of the weaker stock is the absolute difference between the stronger concentration and the target.

Those two differences are the mixing proportions. This calculator does not require you to pre-sort the inputs: field c1 is solution one, field c2 is solution two, and field target is the desired mixture concentration in the same units. Internally the parts of solution one are the absolute value of target minus c2, and the parts of solution two are the absolute value of c1 minus target, which is the same identity regardless of which flask is stronger.

The resulting ratio can be simplified to lowest integer terms, converted to a fraction of the finished mixture, or scaled to any convenient volume: two parts and three parts means two milliliters of the first stock with three milliliters of the second, or two kilograms with three kilograms, as long as the unit of quantity is consistent. When both stocks already equal the target, every mixture is valid and the contract returns one part of each.

When the target equals one stock and not the other, the unused stock contributes zero parts, which is a legal alligation on the boundary. The arithmetic never converts percent to molarity.

Where alligation is used, and how it differs from mixing known volumes

People who type alligation into a search box already know the method by name from a compounding exam, a pharmacy calculations course, or a laboratory SOP. They have two labeled strengths and a target on a prescription or a media recipe, and they need the ratio of parts, not the forward weighted average that starts from volumes you already measured. That forward path is a different search: given c1, v1, c2, and v2, the mixture concentration is the conserved-solute quotient.

Alligation is the inverse: given c1, c2, and target, recover the relative volumes. Dilution calculators that rearrange M1V1 equals M2V2 assume one stock plus pure solvent; alligation also covers two nonzero strengths, including the special case of a stock mixed with water when one concentration is zero. Failed validation does not consume balance.

Keep units consistent, pin the simplified ratio in tests, and you get reproducible mixing proportions for compounding benches, homework oracles, and media kitchens without standing up a computer-algebra system.

Pharmacy compounding of two labeled strengths

A technician enters the two stock concentrations and the prescribed target; the calculator returns the simplified parts ratio before the flasks are measured.

Alligation homework and exam keys

Instructors batch c1, c2, and target triples to mark alligation-alternate worksheets, including the invalid case where the target lies outside both concentrations.

How does the alligation calculator mix two solutions to a target concentration?

Send finite non-negative c1, c2, and target in the same concentration units.

What happens if the target lies outside both concentrations?

No non-negative mixture of those two stocks can produce a strength stronger than both or weaker than both, so the engine refuses the out-of-range target.

How is alligation different from a mixing-two-solutions calculator?

Mixing two known volumes computes the resulting concentration from c1, v1, c2, and v2. Alligation is the inverse: given two concentrations and a target, it returns the ratio of parts you should mix.

Can I alligate a stock with water (zero concentration)?

Yes. Set one of c1 or c2 to zero and keep the target between zero and the stock strength. The zero flask is treated as the weaker solution in the usual alligation alternate construction.

What does the alligation calculator cost?

The browser tool is free on your device.

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/chem/alligation

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/chem/alligation \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"c1":80,"c2":30,"target":50}'
{
  "c1": 80,
  "c2": 30,
  "target": 50
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "chem.alligation",
  "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.

If the target lies outside both concentrations, no physical mixture of those two stocks can reach it and the request fails with invalid_input. Successful API calls are billed at $0.002; validation failures are not charged.

How alligation alternate finds the mixing ratio of two strengths

Units must match across c1, c2, and target: percent with percent, molar with molar, milligrams per milliliter with milligrams per milliliter.

Input contract, response fields, and the outside-the-range error

Digit strings that parse to finite numbers are allowed so a pasted worksheet cell does not need a second conversion. The distinctive physical check is the range: target must lie between c1 and c2 inclusive. The formula field restates parts1 equals the absolute value of target minus c2 and parts2 equals the absolute value of c1 minus target. Example: c1 equals eighty, c2 equals thirty, target equals fifty yields twenty parts of the first stock and thirty parts of the second, which simplifies to two to three, forty percent and sixty percent of the blend. POST a JSON body with three required finite non-negative numbers. c1 is the concentration of the first solution; aliases C1, concentration1, conc1, and solution1 are accepted. c2 is the concentration of the second solution; aliases C2, concentration2, conc2, and solution2 are accepted. target is the desired mixture concentration; aliases desired, target_concentration, C, desired_concentration, and conc_target are accepted. Missing fields, empty strings, non-numeric text, NaN, Infinity, negative concentrations, and values whose absolute size exceeds one trillion fail with invalid_input naming the field, and those failures are not billed. If the desired strength is stronger than both stocks or weaker than both stocks, no non-negative mix of those two solutions can produce it, so the engine rejects the request with a message that the target lies outside both concentrations. On success the JSON echoes c1, c2, and target after stable twelve-decimal rounding, reports parts1 and parts2 as the alligation differences, reports ratio as a simplified string such as two colon three together with integer ratio_parts1 and ratio_parts2, reports fraction1 and fraction2 of the finished mix, reports percent1 and percent2, and reports mixture_concentration as the weighted check that recovers the target. The method field is always alligation_alternate. Pricing for a successful item is a flat $0.002.

Where alligation is used, and how it differs from mixing known volumes

Hospital pharmacies use the ratio to combine a concentrated electrolyte with a weaker bag, teaching labs use it to check alligation-alternate worksheets, and LIMS scripts pin the JSON so a refactor cannot change the criss-cross identity. Pair this endpoint with a volume scaler in your own pipeline when the next step is converting the parts ratio into milliliters for a chosen batch size; this surface stays focused on the alligation ratio that people mean when they search alligation.

Lab and LIMS mix sheets

Scripts call a stable prepaid endpoint for the ratio of parts instead of reimplementing the criss-cross construction in every spreadsheet and language.

Read the full KIT documentation →