hledger-balance
Show balances of accounts in ledger
TLDR
Show the balance change in all accounts from all postings over all time
Show the balance change in accounts named *expenses*, as a tree, summarising the top two levels only
Show expenses each month, and their totals and averages, sorted by total; and their monthly budget goals
Similar to the above, matching accounts by Expense type, as a two level tree without squashing boring accounts
Show end balances (including from postings before the start date), quarterly in 2024, in accounts named *assets* or *liabilities*
Similar to the above, also show zero balances, sort by total and summarise to three levels
Show investment assets' market [V]alue in base currency at the end of each quarter
Show unrealised capital gains/losses from market price changes in each quarter, for non-cryptocurrency investment assets
SYNOPSIS
hledger balance [OPTIONS] [PATTERN ...]
PARAMETERS
-f, --file FILE
Use FILE(S) instead of default journal(s).
-A, --auto
Include auto-generated (virtual) postings.
--average
Show average balance rather than ending balance.
--budget
Show balance with any open budget goal added.
--change
Show change in balance (default is ending balance).
--cumulative
Show cumulative balance at each period end.
--depth N
Show accounts only to N levels deep.
--empty
Show empty (zero balance) accounts.
--flat
Show only accounts matching patterns, no subtotals.
--format FMT
Use custom line format (see manual).
--historical
Show historical ending balance (at period start).
--invert
Reverse sign of balances.
--no-total
Omit grand total.
--only
Show only matched accounts, no others.
--period PERIOD
Show balances in PERIOD (eg monthly).
--related
Show accounts posting to matched accounts.
--row-total
Show running total for matched accounts.
--sort ORDER
Sort accounts by ORDER (eg amount).
--tree
Use tree format (default).
--unrealized
Include open unrealized lot gains/losses.
DESCRIPTION
hledger balance generates balance reports from plain text journal files, showing running totals for accounts matching specified patterns. By default, it displays a tree of top-level accounts with subtotals, including cleared, uncleared, and pending postings. Use options to flatten the view (--flat), limit depth (--depth), show changes instead of balances (--change), or historical ending balances (--historical). It supports multi-currency, lot prices (--lot-prices), budgets (--budget), forecasts (--forecast), and custom formatting (--format). Filters by period (--period), account patterns, and status. Ideal for quick financial overviews, reconciliation, and reporting. Integrates with hledger ecosystem for workflows like importing, checking, and diffing ledgers. Handles virtual/inferred postings with --auto. Output can be CSV, HTML via pipes, or custom formats for scripting.
CAVEATS
Default journal is ~/.hledger.journal or $LEDGER_FILE; specify with -f. Zero balances hidden by default unless --empty. Multi-commodity requires consistent pricing.
EXAMPLES
hledger balance
hledger balance assets:bank --tree --depth 2
hledger balance --period monthly --change
OUTPUT FORMATS
Use --format ' %(account) %balance ' for custom. Pipe to html or csv scripts.
HISTORY
Part of hledger, a Haskell reimplementation of ledger started in 2007 by Simon Michael. Balance command introduced early, evolved with Haskell efficiency, multicurrency (2010+), budgets/forecasts (v1.10+), lot support (v1.20+). Actively maintained with semantic versioning.
SEE ALSO
hledger(1), hledger-register(1), hledger-print(1), ledger(1)


