Money splitter
Split an amount by ratios or into equal parts so the shares are whole cents and add up exactly to the amount.
- Version 1
- Checked against 4 published values
- Free, no sign-up
Result: 0.05 EUR split 70/30, largest remainder
| Total The amount that was split, in the currency's minor unit; the shares add up to exactly this. |
0.05 |
|---|---|
| Shares The shares, in the order of the parts. |
0.04, 0.01 |
| Leftover units How many minor units were left after rounding every share down, and handed out one each. |
1 |
| Decimals The currency's number of decimals (ISO 4217 minor unit). |
2 |
Allocation
| Part | Ratio | Exact share | Share | Extra unit |
|---|---|---|---|---|
| 1 | 70 | 0.035 | 0.04 | yes |
| 2 | 30 | 0.015 | 0.01 | no |
Calculator money/allocate@1.
How it is calculated
units = amount × 10^decimals; share_i = ⌊units × r_i ÷ Σr⌋, then the units − Σshare_i leftover units go one each to the largest remainders (or the first parts)Splits an amount of money between several parts, by ratios (70/30, 1:2:3, percentages) or into equal parts, so that every share is a whole number of the currency's minor unit and the shares add up to the amount exactly: no cent is lost or invented. Rounding each share on its own does not work: 10.00 split three ways rounds to 3.33 three times, which is 9.99. Here each part first gets its exact share rounded down, and the few cents left over are handed out one at a time. Use it for splitting bills, revenue shares, commission, refunds across order lines, or a discount across invoice lines. The currency sets the minor unit: cents for USD and EUR, whole yen for JPY, fils (0.001) for KWD.
- The shares always add up to the amount exactly.
- With largest_remainder (the default), the leftover units go to the parts whose exact shares lost the most when rounded down, so every share is less than one minor unit from its exact share. With in_order they go to the first parts with a ratio above 0, as in Dinero.js, even if a part's exact share was already a whole number of cents, so a share can be a full minor unit off. Both give the same result for equal parts.
- A negative amount is split as if it were positive and every share is made negative, so a refund mirrors the charge.
- To split a whole invoice line by line (for example a discount across items), use the line amounts as the ratios.
References
- Dinero.js: allocate (10.03 split 50/50 gives 5.02 and 5.01; a ratio of 0 gets nothing)
- Largest remainder method (Hamilton's method), with a worked example
- ISO 4217 List One, current currencies and funds (SIX, the maintenance agency)
- ISO 4217 amendment 180: Bulgaria adopts the euro (1 January 2026)
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Use it from your code
curl https://api.curatedapi.com/v1/calc/money/allocate \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": "0.05",
"currency": "EUR",
"ratios": ["70", "30"]
}'
The same call in Python
import os
import requests
payload = {
"amount": "0.05",
"currency": "EUR",
"ratios": ["70", "30"],
}
response = requests.post(
"https://api.curatedapi.com/v1/calc/money/allocate",
headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
json=payload,
timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
"amount": "0.05",
"currency": "EUR",
"ratios": ["70", "30"],
};
const response = await fetch("https://api.curatedapi.com/v1/calc/money/allocate", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log((await response.json()).result);
MCP tool calc_money_allocate at https://mcp.curatedapi.com.
Inputs, outputs and errors in the API reference.
Put it on your website
<div data-curatedapi-widget="money/allocate" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>
Use a public key registered for your site. Calculations are billed like API calls. How widgets work.
Related calculators
Round and split money to the cent in your app
Every share adds up to the total and every cash total follows the country's rule, so the ledger, the receipt and the payout agree.
Free for up to 1,000 payments a month. 50,000 payments a month cost $9.00 on the Starter plan.