Two kinds of shared cost
A trip where everyone arrives and leaves together has one kind of shared cost, and dividing by the head count is the whole job. As soon as people come and go, costs separate into two groups that need different treatment.
Costs that scale with time — the house, the utilities, the cleaning fee that exists because the house was occupied — divide by nights present. Someone there for two nights of four used half as much of the house as someone there for all four, and paying half is not a favour, it is the arithmetic. Costs that do not scale with time — the rental van everyone rode in, a group dinner everyone attended, entry passes — divide evenly, because presence rather than duration is what determined the cost.
Putting a cost in the wrong list is the main way this goes wrong, and the test is simple: if a person staying one extra night would have increased the cost, it belongs in the by-nights list.
Writing the input
People go one per line as a name and the nights they were present, separated by a vertical bar or a tab. A line with no number counts as one night. Fractional nights are accepted if half a stay genuinely needs representing, though rounding to whole nights is usually closer to how anybody remembers the trip.
Payments go one per line as who paid, the amount, and optionally what it was. Names must match the people list exactly; anything else is reported rather than silently counted, so a typo does not quietly change someone's balance. A person who paid for nothing still belongs in the people list — that is the normal case for whoever owes money at the end.
Whole cents, and where the odd penny goes
Everything is converted to integer cents at the point of entry and nothing after that is a decimal. Splitting a cost is a proportional allocation with the largest remainder rule: each person's exact share is calculated, everyone gets the whole-cent part of it, and the pennies left over go one each to the people with the largest fractional parts, ties broken by the order they appear in the list.
The consequence is that a $100 cost split three ways comes out as $33.34, $33.33 and $33.33, and the three add to exactly $100.00. This is done separately for every payment, so no rounding ever accumulates. The totals row shows the sum of what everyone owes against the sum of what everyone paid; they are identical by construction, and the balances add to exactly zero. If they did not, the page would be lying about one of them.
Finding the transfers
Each person's balance is what they paid minus what they owe. Positive means they are owed money, negative means they owe it. The settlement repeatedly matches the largest creditor against the largest debtor and moves the smaller of the two amounts, which zeroes out at least one person on every step.
With n people, that guarantees at most n minus one transfers, and it is usually fewer, because any transfer that exactly clears both sides removes two people at once. Finding the provably smallest possible set of transfers is a harder problem than it looks — it is equivalent to a subset-partition question and is NP-hard in general — but for a group of any size that fits in a house, the difference between this result and the theoretical minimum is at most a transfer or two, and it is never worth the wait. Every transfer is a whole-cent amount and the amounts sum to exactly the money that needs to move.
Where a different tool fits better
If the complication is not who stayed how long but who was present for which expense — two people skipped the boat trip, three shared a taxi — then the split is per expense rather than per person, and the travel expense split takes a participant list on each line and handles that directly. Use this page when duration is the thing that differs and that page when attendance is.
One thing worth doing before sending the transfer list to anybody: read the by-nights and evenly lists back to yourself as sentences. The arithmetic on this page is exact and the categorisation is a judgement, and the only part anyone will argue about is the second one. Settling it before the numbers appear in the group chat is considerably easier than after.
Questions people ask
Someone paid for something that only two of us used. How do I enter that?
Not on this page, cleanly. Both lists here divide across everybody, either by nights or evenly, so a cost shared by a subset does not have a natural home. Either handle those separately between the people involved and leave them out entirely, or use the travel expense split, which takes the list of who each expense covered on the line itself. Mixing the two approaches in one settlement is how a balance ends up wrong in a way nobody can find.
Do the balances really add to zero?
Yes, and the totals row shows it. Every payment is allocated in whole cents that sum to exactly the payment amount, so the total owed and the total paid are the same integer. Each balance is one subtracted from the other, and those balances therefore sum to zero with no tolerance or rounding allowance. The transfers move exactly that money, so after they clear, everyone is at zero.
Can I use this for a shared house rather than a trip?
For a month where people moved in or out partway, yes — nights present is the same idea as days of the month occupied, and rent goes in the by-nights list while a one-off like an internet installation goes in the even list. For an ongoing household with stable occupancy the by-nights split does nothing useful, since everybody has the same number of nights, and an even split calculator is the simpler tool.