📦 This tool now lives in clearbox
It has been merged into a single toolkit with six sibling tools, sharing one design and one bilingual (EN/AR) interface.
→ Use it here: https://wedo911.github.io/clearbox/tools/split/
This repository stays up so existing links keep working, but development continues in clearbox.
Split a group's shared expenses fairly, and get a settle-up plan with the fewest payments needed to make everyone even. Everything runs client-side — no account, no server, data saved only in this browser's local storage. A first in this series in a genuinely different domain: personal finance rather than security, privacy, or accessibility.
Live site: https://wedo911.github.io/fairsplit/
Splitting a shared bill correctly, and then figuring out the smallest set of payments to settle up, is a small but real algorithmic problem — most people just do it in their head and get it slightly wrong, or send five separate payments when two would do. fairsplit does the arithmetic exactly (in integer cents, never floating-point dollars — see below) and computes a minimal-ish settlement plan automatically.
Two pure functions, fully covered by tests that check money-conservation
invariants, not just example outputs — see
js/settleUp.mjs:
computeBalances— turns a list of expenses (who paid, how much, split among whom) into a net balance per person. All arithmetic happens in integer cents; remainder cents from an uneven split (e.g. $10 split three ways) are distributed one at a time so the parts always sum back to the exact original amount — floating-point dollars-and-cents math silently loses pennies over enough expenses, which is exactly the kind of bug that erodes trust in a money tool.settleBalances— takes those balances and computes payments via the standard greedy algorithm (always match the largest creditor against the largest debtor), the same approach production expense-splitting apps use. It's proven to need at most (people with a non-zero balance) − 1 transactions. The absolute mathematical minimum is a harder, subset-sum-adjacent problem (NP-hard in general) that this tool doesn't attempt to solve exactly — the in-app disclaimer says so.
Every test that adds expenses and computes a settlement also verifies the resulting payments bring every balance back to exactly zero, not just that the numbers look plausible.
Static site, no build step:
python -m http.server 8000
# open http://localhost:8000node --test tests/settleUp.test.mjsMIT — see LICENSE.