Using Ledger-cli for joint finances
Posted on do 24 juli 2025 in blog
I have been using ledger-cli since 2015. At first only for my personal finances. To make it easier for myself, I use the CSV files I download from the bank and convert these into ledger-cli transaction files.
Later I incorporated my business records as well. This gave me a single view on all of my finances: personal and business. I use a Python script to export the records from my main accounting software (Odoo) and write them out as ledger-cli transactions.
I was looking for a way to give me
- a view of just my business
- a view of just my personal finances
- a combination of both business and personal finances
I realized that much of what I do to make this happen, can be also applied to joint finances.
Simplified setup
My own setup is quite involved with separate files for nearly every account and each split up again by year. I then combine them in separate ledger files that have a lot of include statements.
To explain the basic reasoning for joint personal and business accounts, I'll simplify to a single file for each member of a two head household with a husband and wife.
Proposed names for the data files for DH (husband), DW (wife), DH~DW (joint accounts):
DH.ledger DW.ledger DH~DW.ledger
We can combine these files in different ways using include.
Joint account view with origin
Let's make a joint account view where every set of accounts is prefixed with its origin. This ledger file could be named all.ledger. It could have the following contents:
# all.ledger apply account Husband include DH.ledger end apply account apply account Wife include DW.ledger end apply account apply account Joint include DH~DW.ledger end apply account
Consolidated joint view
A consolidated joint view. This ledger file could be called joint.ledger. It could have the following contents:
# joint.ledger include DH.ledger include DW.ledger include DH~DW.ledger
The trick here is to use the same setup of accounts for all parties. This makes consolidating easy. The former ledger file is capable of showing individual contributions of DH, DW and joint accounts to income, expenses, assets and debts. The latter ledger file gives you the consolidated numbers for each unique account.
Example reports
Generating reports using either all.ledger or joint.ledger could look like this:
ledger -f joint.ledger bal Assets or Liabilities # household balance ledger -f joint.ledger bal Income or Expenses # household profit and loss ledger -f all.ledger bal Husband and \( Income or Expenses \) # DH profit and loss ledger -f all.ledger bal Wife and \( Assets or Liability \) # DW balance
Dividing expenses between partners
In some prenuptial agreements, partners agree to keep a record of the contributions to the household.
For this you can use these four different reports:
ledger -f joint.ledger -M -n --begin '3 months ago' reg Expenses ledger -f all.ledger -M -n --begin '3 months ago' reg Expenses and Husband ledger -f all.ledger -M -n --begin '3 months ago' reg Expenses and Wife ledger -f all.ledger -M -n --begin '3 months ago' reg Expenses and Joint
The first report gives the total cost of expenses over the given time period. We use this to verify corrections and interim calculations.
The following three reports are views into how expenses were handled individually: by the husband, by the wife and through the joint accounts.
I use org-mode to tabulate and calculate the totals and the redistribution. Here's an example:
#+name: Auxiliary table for calculating distribution of expenses | Description | Husband | Wife | Total | |-----------------+---------+-------+--------| | Expenses | 45.85 | 16.19 | 62.04 | |-----------------+---------+-------+--------| | Total | 45.85 | 16.19 | 62.04 | | Equal distrib. | 31.02 | 31.02 | 62.04 | |-----------------+---------+-------+--------| | Left to pay | -14.83 | 14.83 | 0.00 | #+TBLFM: $4=$2+$3;%.2f :: @3$2=vsum(@I..@II);%.2f :: @3$3=vsum(@I..@II);%.2f :: @4$2=@3$4/2;%.2f :: @4$3=@3$4/2;%.2f :: @5$2=@4$4/2-@3$2;%.2f :: @5$3=@4$4/2-@3$3;%.2f
To do the same by hand, first sum individual expenses: see column Total for the line Expenses. Divide this number by two and put these numbers on the line Equal distrib. for each partner. This how much each partner should have payed if they each payed for exactly half of the expenses. Finally, subtract the amount payed by the equalized amount. The partner with the negative number gets compensated by the partner with the positive number. In the example above, Wife still needs to pay € 14.83 to Husband.
To check your calculations, the amount Left to pay for Husband and Wife need to be the same, except for the minus sign.
Working with transit or interim accounts
For correct reports, we need a special way to record the transfer funds of between partners. In these cases we use a transit account to hold the money. One partner sends money to this transit account while the other moves the money from the transit account to the proper place.
These transit accounts naturally sit under Equity in the hierarchy of accounts.
Example: cash changes hands
DH gives € 50 cash to DW.
In husband's ledger DH.ledger this is recorded as:
2025/07/07 * Cash to DW Assets:Cash € -50.00 Equity:Transit
While in wife's ledger DW.ledger:
2025/07/07 * Cash from DH Assets:Cash € 50.00 Equity:Transit
When generating a report using the joint.ledger this transit account Equity:Transit will end up with a net zero balance. Compare:
$ ledger -f joint.ledger --empty bal Transit 0 Equity:Transit $ ledger -f all.ledger --empty bal Transit € 50.00 Husband:Equity:Transit € -50.00 Wife:Equity:Transit -------------------- 0
Example: contributions into a joint account
When both husband and wife are putting in a contribution in the joint account at the bank, we record these transactions.
In husband's ledger DH.ledger:
2025/07/18 * Contribution to joint account Assets:Bank:DH Account € -50.00 Equity:Household Contribution
And in wife's ledger DW.ledger:
2025/07/10 * Contribution to joint account Assets:Bank:DW Account € -50.00 Equity:Household Contribution
In the joint ledger DH~DW.ledger:
2025/07/10 * Contribution from DW Assets:Bank:Joint Account € 50.00 Equity:Household Contribution 2025/07/18 * Contribution from DH Assets:Bank:Joint Account € 50.00 Equity:Household Contribution
Again, generating a report from joint.ledger will show a zero balance for Equity:Household Contribution. While using all.ledger shows individual contributions. Compare the following:
$ ledger -f joint.ledger --empty bal Contribution 0 Equity:Household Contribution $ ledger -f all.ledger bal Contribution € 50.00 Husband:Equity:Household Contribution € -100.00 Joint:Equity:Household Contribution € 50.00 Wife:Equity:Household Contribution -------------------- 0