# Expense splitter > **Experimental.** A working reference exists with two illustrative examples built from invented people and amounts. It has no qualification and no human review, so it is not Supported. ## Purpose and inputs An expense splitter works out who owes whom for a shared trip or household. A visitor adds the people, then each expense with its amount, who paid and who shared it, and gets each person's balance and a short list of payments that settles everyone. Everything runs in the visitor's browser: no bank, no payment, no server. The owner configures the page in one `content.json`: - `schema` (1), `illustrative` (true while the sample is invented), `locale` (`en` or `pt-BR`), `layout` (`journey` or `household`), `title`, `description` and an optional `intro`. - `currency` (three uppercase letters, for example `EUR`) and `exponent` (decimal places, 0 to 6). Both are stated, never looked up or guessed, and the whole page uses that one currency. - An optional `sample` with a `label`, `participants` (`id` and `name`) and `expenses` (`id`, `description`, `payer`, `amountMinor`, `shares`). Amounts are integer minor units: 12.50 EUR is `1250`. Each share is `{participant, weight}`; equal split is weight 1 for everyone. The visitor sees the sample first, labelled as sample data, with a clear "Start with my own expenses" button. Build with `node reference/build.mjs `; the page is written to `/public`. A bad configuration lists every problem with its path and writes nothing. ## How the arithmetic works All amounts are exact integers. For each expense, each beneficiary first gets the whole-unit floor of `amount × weight ÷ total weight`. The few leftover smallest units are then handed out one each to the beneficiaries whose internal IDs sort first (plain character order). That is deliberate: the result never depends on the order people were entered, and the same data always gives the same split. It is not the "largest remainder" method, and a leftover unit can land on someone whose share was already exact. The page shows, per expense, which share took a leftover unit. The payer is credited the full amount and each beneficiary is debited their share, so balances always add to exactly zero. Suggested payments settle debtors against creditors greedily, both in ascending ID order. They are one valid way to settle, not claimed to be the fewest. Every figure is a safe exact integer; if a total cannot be shown exactly the change is refused instead of rounded. Correcting or deleting an expense recomputes everything from the expenses, never from a cached total. Renaming a person keeps their ID, so nothing changes. ## Device-local draft, private file and shared summary - **Draft:** kept in this browser's local storage under a versioned key scoped to this published page, only if storage works. If storage is blocked, full or unreadable, the page says so; editing, export and reset keep working. Nothing syncs and nothing is sent anywhere. Reset clears only this page's key. - **Private draft file:** export holds names, descriptions and private notes, and importing it restores everything. A file with another currency, schema, mixed currencies or amounts that cannot add up exactly is refused and the current work is left untouched. - **Shared summary:** a separate, allowlisted file with balances and suggested payments. By default people are `Person1`, `Person2`… and every internal ID is remapped, so no name, note, expense description or imported ID is in it. Names are included only if the visitor ticks the option, and the preview shows exactly the bytes that will be downloaded. Nothing is posted or uploaded. ## Completion checks - Totals balance exactly in the stated currency; a split that does not divide evenly shows where the leftover went. - Editing, deleting and undo recompute consistently; an invalid amount or file leaves the current work and result unchanged. - The downloaded summary equals its preview and carries no private note. - Without JavaScript the page explains that it needs JavaScript and shows no balances. ## Limits and optional additions There is no bank connection, payment, reminder or money movement; the arithmetic is not financial advice, and the page cannot tell whether anyone has actually paid. A private shared app for participants is an unavailable addition, only where the owner asks. Optional addition: Cost-per-use calculator, for seeing what a shared purchase costs per use. Download the readable settlement as a text file, or keep the JSON summary for software. Both use the same sharing choices: names are opt-in, and notes and expense descriptions stay private.