All articles

Settling up

The fewest payments that settle everyone up

Five people, six shared expenses, and everyone paid for something. Done item by item that is 21 separate paybacks. Done properly it is four payments, nobody is a cent better or worse off, and the method is simple enough to do on paper.

Updated September 20269 min read

The short version

Do not pay people back expense by expense. Work out one number per person, which is what they paid minus their share of everything they took part in, and then send money only from the people who are down to the people who are up. Nobody should be paying and being paid.

On the trip below, 6 shared expenses across 5 people come to $3,863.50. Paying each other back item by item takes 21 payments. Settling on the net takes 4, and every single person is out exactly the same amount either way.

The rule worth remembering

You never need more payments than one fewer than the number of people who owe or are owed something. Five people, at most four payments. Twenty people, at most nineteen. If you are sending more than that, you are settling the wrong thing.

Stop thinking in pairs

The reason a group holiday ends in a spreadsheet nobody trusts is that people settle up the way the expenses happened: you covered dinner so I owe you a quarter, I bought the groceries so you owe me a fifth, and around it goes. Every expense generates one payment per person who was in it, and they all point in different directions.

This page assumes the shares themselves are already agreed. If that part is still open, whether a cost should be divided equally, by income, by room or by usage, how to split shared costs fairly is the place to start, because settling the wrong shares efficiently is still the wrong answer.

Here is the trip. One week, five people, and deliberately not everybody in everything, because that is the case where the arithmetic stops being obvious.

  • Ana booked the flights, $1,250, all five
  • Ben paid for the house, $1,800, all five
  • Ana also took the car hire, $340, all five
  • Cleo did the big grocery run, $212.50, all five
  • Dan covered dinner, $186, but Eve had already eaten
  • Eve paid for the museum, $75, and only Ana and Ben went

Item by item, that is 21 separate paybacks: four people owing Ana for the flights, four owing Ben for the house, four more owing Ana for the car, four owing Cleo, three owing Dan, two owing Eve. Twenty one separate transfers for six purchases, and Ana is both sending money and receiving it four times over.

Anyone who is both paying and being paid is a sign you are settling the transactions instead of the position.

Work out the net, once

One number per person: what they paid out, minus what their fair share of everything came to. Positive means the group owes them, negative means they owe the group. The two things that make this reliable are that shares are computed per expense over only the people who were in it, and that the numbers add to zero when you are done, which is the check that catches a mistake.

Ana

Paid out
$1,590.00
Their share
$792.00
Net
+$798.00

Ben

Paid out
$1,800.00
Their share
$792.00
Net
+$1,008.00

Cleo

Paid out
$212.50
Their share
$767.00
Net
-$554.50

Dan

Paid out
$186.00
Their share
$767.00
Net
-$581.00

Eve

Paid out
$75.00
Their share
$745.50
Net
-$670.50
The same $3,863.50 of spending, expressed as five numbers instead of 21 debts. The net column sums to zero.

The shares are not equal, and they should not be. Ana and Ben were in all six expenses, so they carry $792 each. Cleo and Dan missed the museum, so $767. Eve missed dinner, so $745.50. The differences are small but they are real, and an app that divided the total five ways would have charged Eve for a dinner she did not eat.

Route the payments

Two people are up and three are down, so money flows one way only. Take the largest debt and the largest credit and match them: whichever is smaller gets cleared completely, and that person drops out. Repeat with what is left. That is the whole algorithm.

On this trip it produces four payments:

  • Eve pays Ben $670.50, which clears Eve
  • Dan pays Ben $337.50, which finishes Ben
  • Dan pays Ana $243.50, which clears Dan
  • Cleo pays Ana $554.50, which clears Cleo and Ana together

Four transfers, no cash, nobody chasing anybody for a share of a museum ticket. Add the two payments Ben receives and you get $1,008, his exact net. That property, that the payments reproduce each person's net figure and nothing else, is what makes this safe rather than merely tidy.

Four payments is also four things somebody has to remember to do, and one of them not arriving is the normal outcome rather than the unlucky one. When someone doesn’t pay you back picks up from exactly here.

How few payments are possible

Each payment can be made to zero out at least one person completely, by sending exactly the smaller of the two amounts. Zero out one person per payment and after n minus 1 payments the last person must be square too, because the numbers sum to zero and there is nothing else left to balance.

So five people never need more than four payments, twenty never need more than nineteen, and the 21 paybacks the trip started with were never necessary. It is often fewer than the bound: anyone already square drops out before you start, and any pair whose amounts happen to match exactly clears in a single payment.

Why the count matters at all

Every payment is a thing somebody has to remember to do. A group that owes each other 21 payments settles about four of them and gives up, and then the money quietly becomes a grievance. Four is a number people finish.

Where the greedy method loses, including ours

Matching biggest to biggest is fast and it always hits the n minus 1 bound, which is why essentially every app that does this uses it. What almost every app also says, ours included in the comment above the function, is that the result is the minimal set of payments. That is not quite true, and the counterexample is small enough to check by hand.

Take five people at -12, -11, +1, +11, +11. Greedy starts with the biggest debt, -12, and sends it to one of the +11s. That clears the creditor and leaves a dangling dollar, and the whole thing takes four payments. But look at the numbers: the person at -11 and one of the people at +11 cancel each other exactly. Pair those two off first and the remaining three settle in two payments, for a total of three. Greedy destroyed a perfect match by insisting on going in order of size.

Doing it optimally every time means finding as many groups as possible whose balances each sum to zero, and that is an NP-hard problem: there is no known method that is both fast and always right. Searching 53,163 random groups of four to seven people, greedy needed up to two payments more than the true optimum. So the honest claim is not that this is the minimum. It is that it is never worse than n minus 1, it is instant, and it gives the same answer every time you run it, which for settling a holiday is the trade every app makes and none of them mention.

Settle your own trip

Put your own people and expenses in. Toggle who actually shared each one, which is the part spreadsheets get wrong, and watch the payment count collapse.

Who was there

What got paid for

shared by
shared by
shared by
shared by
shared by
shared by

Total spent

$3,863.50

Paying back item by item

21 payments

Settling on the net

4 payments

PersonPaidTheir shareNet
Ana$1,590.00$792.00+$798.00
Ben$1,800.00$792.00+$1,008.00
Cleo$212.50$767.00-$554.50
Dan$186.00$767.00-$581.00
Eve$75.00$745.50-$670.50

Send these

  • EvepaysBen$670.50
  • DanpaysBen$337.50
  • DanpaysAna$243.50
  • CleopaysAna$554.50

The net column sums to zero and the payments add up to it exactly. Toggle who shared an expense and watch the payment count move: this is the same solver the app runs, not a simplified version of it.

This runs the same two functions the app runs, in your browser, and nothing is sent anywhere. If you would rather have one shared pot and just enter what each person paid, the standalone version is simpler.

Free tool, no signup

Who owes who

One pot, what each person paid, and the payments that clear it. No signup, inputs saved on this device.

The objection: why am I paying someone I never bought anything with?

This is the one real complaint about netting off, and it deserves a straight answer rather than a shrug. On the trip above Cleo pays Ana $554.50, even though Cleo's own spending was a grocery run that Ana only partly benefited from. The routing is chosen to minimize the number of payments, not to retrace who bought what.

What has to be true for that to be acceptable is that nobody's total changes, and it does not. Each person's net is settled before any routing happens. Cleo is down $554.50 whether she pays it to Ana in one transfer or to four people in seven. If the specific pairing genuinely matters, because you are splitting with someone you would rather keep a clean record with, settle each expense on its own: you will pay the same amount in more payments, and that is a legitimate choice rather than a mistake.

The one case to be careful with

If somebody in the group is unlikely to pay, netting concentrates that risk. Route the payments so the unreliable person owes one identifiable individual rather than being spread across three, and settle with them first. It costs a payment or two, and it means one person is chasing one debt instead of three people each being short.

Common questions

What is debt simplification?
Instead of paying back each person for each expense, you work out one net figure per person, then route payments only from the people who are down to the people who are up. Nobody pays and gets paid. On a five-person trip with six shared expenses, paying everyone back item by item takes 21 separate payments; the net version takes 4, and everyone is out exactly the same amount of money.
What is the fewest payments needed to settle a group?
Never more than one less than the number of people who are not already square. Five people who all owe or are owed something need at most 4 payments, because every payment can be made to zero out at least one person completely. Often it is fewer: anyone who happens to be exactly square drops out, and any pair whose amounts match exactly clears in a single payment.
Why am I being asked to pay someone I never bought anything with?
Because the routing is chosen to minimize the number of payments, not to retrace who bought what. If you owe $30 and three different people are owed money, sending your $30 to whichever one it clears completely is one payment instead of three. The total you pay does not change. If it matters to you to pay the specific person you shared an expense with, settle each expense separately: you will pay the same amount, in more transfers.
Does anyone end up paying more when debts are simplified?
No. Each person's net figure is fixed before any routing happens: it is what they paid minus their share of everything they took part in. Simplification only decides who hands money to whom. Every person is out or up by exactly the same amount either way, which is the property worth checking in any app that does this, because it is what makes the shortcut safe rather than merely convenient.
Is the greedy method always the fewest possible payments?
Not quite, and most apps including ours describe it as though it were. Matching the biggest debtor to the biggest creditor can break up a pair whose amounts cancel exactly. With balances of -12, -11, +1, +11 and +11, greedy needs 4 payments while 3 are possible, because -11 and +11 clear each other in one. Finding the true minimum every time is an NP-hard problem, so every practical app uses a fast method with a good bound instead.
Should you settle up during a trip or at the end?
At the end, once. Settling mid-trip means recalculating a moving target, and any payment made before the last expense lands is a payment you may have to partly undo. The exception is a trip long enough that someone genuinely runs short of cash, in which case treat the early payment as its own recorded settlement rather than as an informal favor, or it will be counted twice.

If you would rather not do this by hand

Halvy keeps the net position live as expenses go in, so at the end of a trip the payments are already worked out and each person sees only what they owe. It splits by income too, for free, and it never asks to connect to a bank. Free on iOS and Android.

Every figure here was produced by running Halvy's own split and settlement functions on the worked example. The claim that the greedy method is not always minimal was checked rather than assumed: a brute-force optimum over every zero-sum grouping, compared against the shipped solver on 53,163 random groups, plus an exhaustive search for the smallest counterexample, which is the five-person case quoted above.