Plain-text accounting is bookkeeping done in text files, with command-line tools. Your ledger is source code — diffable, scriptable, and yours to keep.
.beancount
file; the compiler validates every balance, every currency, every posting.
;; -*- mode: beancount -*- ;; A minimal personal ledger. 2026-01-01 open Assets:Checking USD 2026-01-01 open Equity:Opening-Balances 2026-01-02 * "Deposit" Assets:Checking 100.00 USD Equity:Opening-Balances
Account names are colon-separated hierarchies, each segment capitalized. The first segment must be one of five roots.
Beneath that, organize however you like — by bank, by country, by card, by purpose. The hierarchy is your chart of accounts.
Assets:US:Chase:Checking Assets:Broker:Stock Liabilities:US:Amex:Platinum Liabilities:Mortgage Income:US:Acme:Salary Income:Interest Expenses:Food:Groceries Expenses:Travel:Hotel Equity:Opening-Balances
2026-02-14 * "Whole Foods" "Valentine's groceries" Liabilities:US:Amex:Platinum -82.40 USD Expenses:Food:Groceries 65.00 USD Expenses:Home:Flowers 17.40 USD
2026-01-01 open Assets:Checking USD 2026-03-01 balance Assets:Checking 1204.17 USD 2026-03-01 pad Assets:Checking Equity:Opening-Balances 2026-04-15 price EUR 1.08 USD 2026-06-30 close Assets:OldBank
Anything countable is a commodity: currencies, shares, crypto, vacation hours, airline miles.
Lot prices {…} track what you paid; market prices @… track what it's worth today.
; Buying 10 shares of AAPL at $150 — cost basis recorded as a lot. 2026-01-15 * "Buy stock" Assets:Broker:Stock 10 AAPL {150.00 USD} Assets:Broker:Cash -1500.00 USD ; Spending euros from a USD account — @ records the exchange rate. 2026-03-20 * "Coffee in Paris" Assets:USD -4.50 USD @ 0.92 EUR Expenses:Food:Coffee 4.14 EUR
When you buy an asset, beancount remembers each lot — its price and date. Sell later, and you must say which lot.
; Three separate purchases — three separate lots. 2024-03-10 * "Buy AAPL" Assets:Broker:Stock 10 AAPL {150.00 USD, 2024-03-10} Assets:Broker:Cash -1500.00 USD 2025-01-08 * "Buy AAPL" Assets:Broker:Stock 5 AAPL {220.00 USD, 2025-01-08} Assets:Broker:Cash -1100.00 USD ; Sell 5 shares — identify the lot, and record today's price. 2026-04-20 * "Sell AAPL" Assets:Broker:Stock -5 AAPL {150.00 USD, 2024-03-10} @ 210.00 USD Assets:Broker:Cash 1050.00 USD Income:Gains USD ; auto-balanced → −300.00 USD realized gain
Stuck to the asset. This is what you paid. It creates a new, distinct inventory lot and stays with the shares until they leave.
Used for: cost basis, realized gains, tax lots.
A passing rate. Tells beancount how to convert one commodity to another in this transaction. Informational — it doesn't create a lot.
Used for: FX conversions, current market value.
5 AAPL {150.00 USD} @ 210.00 USD
— selling a lot I bought at $150, at today's price of $210.
Every transaction contributes prices; price
directives add quotes directly. Beancount builds a time-series — one point per commodity per day — and interpolates when you ask for a holding's value.
; Weekly quotes. 2026-01-06 price AAPL 188.50 USD 2026-01-13 price AAPL 192.10 USD 2026-01-20 price AAPL 201.75 USD 2026-01-27 price AAPL 208.40 USD 2026-02-03 price AAPL 212.00 USD 2026-01-06 price EUR 1.088 USD 2026-02-03 price EUR 1.094 USD 2026-01-06 price BTC 42100.00 USD 2026-02-03 price BTC 46580.00 USD
Fava and BQL use this series for net worth over time, unrealized gains, and performance vs. cost basis — all from one text file.
SELECT account, SUM(position) and get answers in milliseconds.