Beancount Language Syntax
This provides a concise yet comprehensive reference for the Beancount language syntax, blending practical structure, rules, and examples. For more details, see the Cheat Sheet.
Overview
Beancount is a plain-text double-entry accounting system. Its language is structured around three main building blocks:
- Commodities (currencies, stocks, points, etc.)
- Accounts (hierarchical, categorized ledgers)
- Directives (dated entries recording events or configuration)
Commodities
Commodities are always written in uppercase, e.g., USD
, EUR
, AAPL
, BTC
, MILES
, HOURS
.
Accounts
Accounts are colon-separated, capitalized hierarchical names. They must begin with one of the five root account types:
Name | Type | Typical Contents | Example |
---|---|---|---|
Assets | + | Cash, Bank, Investments | Assets:Checking |
Liabilities | - | Credit Cards, Loans | Liabilities:CreditCard |
Income | - | Salary, Interest | Income:EmployerA |
Expenses | + | Purchases, Bills | Expenses:Food:Dining |
Equity | - | Opening/Closing Balances | Equity:Opening-Balances |
- Components must be capitalized, separated by colons (
:
), with no spaces. - Numbers and dashes are allowed in components.
- The root account names can be customized via options (see below).