CalcOpenly
English

Group expense splitter for trips and parties

Split group expenses equally and see who pays whom. Find the fewest payments for up to 16 non-zero balances, with an approximate plan for larger groups.

Drafted with AI writing toolsUpdated Checked examples: 4

One payment per line: “Alex paid 120 for food” or “Alex, 120, food”.
Separate names with commas. Include people who paid nothing; leave blank to split among the payers only.
Try
Each person's share
$
Each person's share: $48.88
Decimal places: 2; Nearest, ties to even
Total spent
$195.50
Payments to settle up
3
People
4
Who pays whom
Jo pays Alex $48.88; Priya pays Alex $18.88; Sam pays Alex $3.38

Total spent: $195.50; each person's share: $48.88. 3 payments settle everything: Jo pays Alex $48.88; Priya pays Alex $18.88; Sam pays Alex $3.38.

Paid minus share

Alex$71.13Sam−$3.38Priya−$18.88Jo−$48.88
Payments to settle up Rows: 3
FromToAmount
JoAlex$48.88
PriyaAlex$18.88
SamAlex$3.38
How it's calculated S
  1. Total and equal share

    195.504=48.875\frac{195.50}{4} = 48.875

    In the formula, P_i is what each person paid, n the group size, q the equal share, b_i each balance, k the number of non-zero balances and G_max the largest number of zero-sum groups. N_min is the minimum payment count, found by exact search only up to 16 non-zero balances.

  2. Balance: paid minus share

    Alex 120 − 48.875 = 71.125; Sam 45.5 − 48.875 = −3.375; Priya 30 − 48.875 = −18.875; Jo 0 − 48.875 = −48.875

  3. Fewest payments

    There are 4 non-zero balances. Each zero-sum group of g people settles in g − 1 payments: 3 in total.

    Amounts are rounded to the cent for display, so a payment can differ from the exact balance by less than a cent.

About the group expense splitter

Each person's share is the total spent divided by the number of people. A balance is what someone paid minus that share: a positive balance is owed money and a negative one owes it. The calculator then splits the balances into as many groups as possible whose balances cancel out exactly, because a group of g people can always settle in g − 1 payments.

With the defaults, Alex, Sam and Priya paid 195.50 between them and Jo paid nothing, so each share is 48.875. Three payments settle everything: Jo pays Alex 48.88, Priya pays Alex 18.88 and Sam pays Alex 3.38.

Finding the fewest payments is NP-hard in general (Verhoeff, 2004), so the exact search runs when up to 16 people have a non-zero balance; larger groups fall back to paying the largest creditor from the largest debtor. Payments are shown to the cent, so each can differ from the exact balance by less than a cent.

How to split group expenses and settle up

When a group shares all costs equally, add up everything spent and divide by the number of people to get each share. A person's balance is what they paid minus that share: positive means they get money back, negative means they owe. If four people spent 195.50, each share is 48.875.

Worked example: who owes whom

Alex paid 120, Sam 45.50 and Priya 30. Jo paid nothing but shares the costs.

  1. Total spent: 120 + 45.50 + 30 + 0 = 195.50.
  2. Equal share: 195.50 ÷ 4 = 48.875.
  3. Balances: Alex 120 − 48.875 = +71.125, Sam −3.375, Priya −18.875, Jo −48.875.
  4. Settle: Jo pays Alex 48.875, Priya pays Alex 18.875 and Sam pays Alex 3.375.

The three debts add up to 71.125, exactly Alex's credit. Credits and debts always cancel, so if yours do not, an amount was copied wrong.

How few payments can settle a group?

If k people have a nonzero balance, k − 1 payments always suffice, since each payment can clear at least one person. Fewer are possible when the balances split into groups that cancel out: a group of g people settles in g − 1 payments.

Five people paid 14, 13, 12, 5 and 6. The share is 10, so the balances are +4, +3, +2, −5 and −4. E pays A 4, which closes one group; D pays B 3 and C 2, which closes the other. That is 3 payments.

Paying the largest creditor from the largest debtor first takes 4 payments for the same group. Finding the best grouping is NP-hard in general (Verhoeff, 2004), so it takes a search.

The search is exact when up to 16 people owe or are owed; people who are already even do not count. Larger groups are matched largest-first, which still settles every balance exactly but may use a few extra payments.

Rounding to the cent

A share of 48.875 is not a whole number of cents, so no settlement in cents can be exact. Rounded, the three payments are 48.88, 18.88 and 3.38. They total 71.14, so Alex receives 1.5 cents more than the exact 71.125.

Round only the final payments. Rounding the share to 48.88 first makes the four shares total 195.52, and the books stop balancing: Alex's credit drops to 71.12 while the debts still add up to 71.14.

Any total that does not divide evenly behaves this way. When one person pays 10 for three people, each share is 3.333…, and after two payments of 3.33 the payer's own cost is 3.34.

When only some people share a cost

Split each cost among the people who actually shared it, then add each person's balances across the splits. Say Alex paid 400 for a hotel shared by all four, and Sam paid 60 for train tickets for Sam and Priya only.

  • Hotel: share 100. Alex +300; Sam, Priya and Jo −100 each.
  • Train: share 30. Sam +30; Priya −30.
  • Net: Alex +300, Sam −70, Priya −130, Jo −100.

Three payments settle the net balances: Sam pays Alex 70, Priya pays Alex 130 and Jo pays Alex 100. Settling the two splits separately takes four, because Priya would also pay Sam 30.

Example settlements

ScenarioTotal spentEqual sharePayments
Default195.50000048.8750003.000000
Minimum beats greedy50.00000010.0000003.000000
Everyone even30.00000010.0000000.000000
Added payer120.00000040.0000001.000000
Repeating share10.0000003.3333332.000000
  • Default is the four-person example, and Minimum beats greedy is the five-person group.
  • Everyone even: three people each paid 10, so nobody pays anyone.
  • Added payer: Alex paid 60, Sam 20 and Kim 40, but only Alex and Sam were listed as sharers. Kim joins as a third person, each share is 40, and Sam pays Alex 20.
  • Repeating share: one person paid 10 for three people.

Entering payments

  • Write one payment per line, as Alex paid 120 for food or Alex, 120, food. The description is optional, and several lines for one person add up.
  • List everyone who shares the costs, including people who paid nothing. With no list, the costs are split among the payers only.
  • A payer missing from the list joins the group and takes a full share, as Kim did.
  • Capitals and extra spaces in names are ignored: ALEX LEE and Alex Lee are one person, even with a double space between the names.
  • Amounts must be zero or more, for up to 50 people. Subtract a refund from the payment it belongs to before entering it.

Mistakes that skew the split

  • Leaving out someone who paid nothing. Without Jo, the share becomes 65.17 instead of 48.875, and Alex is owed 54.83 instead of 71.125.
  • Splitting every cost among everyone. A cost only some people shared belongs in its own split, as with the train tickets above.
  • Mixing currencies. Convert every receipt to one currency, at the rate actually paid, before adding them up.

Planning a trip or splitting one bill

To estimate costs before anyone pays, use the travel budget calculator. For a single restaurant bill with a tip, the tip calculator splits the total and the gratuity.

Worked examples

Three payers and one person who paid nothing

Who paid what
Alex, 120 Sam, 45.50 Priya, 30
Everyone sharing the costs
Alex, Sam, Priya, Jo
Total spent
195.50
Each person's share
48.88
Payments to settle up
3
Who pays whom
Jo pays Alex $48.88; Priya pays Alex $18.88; Sam pays Alex $3.38

Checked against: 195.50/4 = 48.875; balances −48.875, −18.875, −3.375 rounded half-even to cents; 3 payments by brute-force subset search

A case where matching the largest amounts first needs 4 payments, not 3

Who paid what
A, 14 B, 13 C, 12 D, 5 E, 6
Each person's share
10.00
Payments to settle up
3

Checked against: Brute-force partition into zero-sum groups {A, E}, {B, C, D}: 5 − 2 = 3; largest-first greedy gives 4

Everyone paid the same

Who paid what
A, 10 B, 10 C, 10
Each person's share
10.00
Payments to settle up
0
Who pays whom
Everyone is even: no payments needed.

Checked against: Definition: every balance is 0

A payer missing from the list is added

Who paid what
Alex, 60 Sam, 20 Kim, 40
Everyone sharing the costs
Alex, Sam
People
3
Each person's share
40.00
Payments to settle up
1
Who pays whom
Sam pays Alex $20.00

Checked against: Hand calculation: 120/3 = 40; Alex +20, Sam −20, Kim 0

Questions

How do you split expenses in a group?

Add up everything spent, divide by the number of people to get the equal share, then subtract that share from what each person paid. For 195.50 spent across four people the share is 48.875: Alex, who paid 120, is owed 71.125, and Jo, who paid nothing, owes 48.875. Everyone with a negative balance pays someone with a positive one.

What is the fewest number of payments needed to settle up?

At most one fewer than the number of people with a non-zero balance, and fewer when the balances split into groups that cancel out, since each group of g people needs g − 1 payments. Tom Verhoeff's 2004 paper shows that finding the minimum is at least as hard as the subset-sum problem, so an exact answer needs a search.

Why can paying off the biggest debts first need extra payments?

It can miss groups that cancel out. With balances of +4, +3, +2, −5 and −4 (people A to E in the worked example), matching the largest amounts first takes 4 payments. Splitting them into {+4, −4} and {+3, +2, −5} settles the first pair in 1 payment and the trio in 2, so 3 in total.

What if some costs are shared by only part of the group?

This splitter shares every cost equally among everyone listed. For a cost that only some people share, such as two people's train tickets, run it separately with just those people, then add the payments from both runs. The combined list settles every debt, though it may use one or two more payments than a single optimised plan.

About this calculator

q=∑Pin,bi=Pi−q,Nmin⁡=k−Gmax⁡q = \frac{\sum P_i}{n},\qquad b_i = P_i - q,\qquad N_{\min} = k - G_{\max}

Sources

  1. Verhoeff, T. (2004). Settling multiple debts efficiently: an invitation to computing science. Informatics in Education 3(1)

Checked against references

This calculator includes 4 worked examples with independently sourced answers. They run in the test suite, and you can run them here too.

Put this calculator on your site

Paste this where you want the calculator to appear. It is free to use, it stays in step with corrections made here, and the credit line below it links back so your readers can find the full version.

Height
Preview the embed

Keep the credit line. It is the only condition, and it is what keeps these calculators free.