GitHub
Budget

The Budget tab and its ~ rules

The Budget tab shows how you are doing against your plan (the bars) and what the plan says (the goals). You can edit the goals. Ledgeline writes your budget back into your journal as ordinary hledger ~ periodic rules, which hledger balance --budget reads the same way it always has.

The bars and the goals share one table. Each goal sits on the same row as its progress, and you change a goal by clicking its budgeted amount. See The budget table.

The Budget tab for the year to 8 July 2026: the controls, then a bar for each budgeted expense. Subscriptions is over its goal and the other five are under, travel included

The design notes and the reasons for each decision are in plans/15-budget-editor.md.

What a budget is, in the file

A budget goal is one posting inside a ~ periodic transaction rule:

~ monthly  household budget
    (expenses:food)      $400
    (expenses:bus)        $20

~ yearly  annual budget
    (income:interest)  $-1200

~ monthly says how often the goal recurs. Each indented line is one goal: an account and an amount. The parentheses make it an unbalanced virtual posting, which lets a rule state a food goal without also stating where the money comes from. Every hledger budget example uses this form, and it is the form Ledgeline writes.

Everything in the tab comes from these lines. There is no separate budget database, no sidecar file of Ledgeline’s own, and nothing here that hledger cannot read.

Recognition schedules are never goals

Revenue and expense recognition schedules are ~ rules too, but they live in their own file, which the journal does not include, so neither hledger nor this tab reads them as goals. If a journal does include that file by mistake, Ledgeline still leaves any rule with a recognition: tag out of the budget, the “Not budgeted” section and projections, and Problems asks you to remove the include. hledger bal --budget has no such filter, so it would still count them.

The Other budget goals section with its Add a budget goal button. Every goal already has a row in the table, so the list says so

Picking a category

The category field is a combobox over your chart of accounts. Start typing and it suggests matches. Matching is by segment, so ex:gr finds expenses:groceries, and the letters of xpg do not have to be in order. Tab completes to the longest shared prefix, the arrow keys move through the list, Enter picks, and Escape closes the list without discarding what you typed.

The list opens when you type, not when the field gets focus. The field is focused for you when the dialog opens, and a list opened at that moment would be positioned against a dialog that is still animating into place.

Any account is allowed. Most goals are expenses, but you budget an income account the same way. See Income and the sign.

Where your goals get written

Ledgeline edits each goal where it already is. It finds every ~ rule in every file your journal includes, and edits a goal in the file it is already written in. It never moves one.

If you have no goals yet, the tab offers to create a budget file:

Create budget.journal

This does two things, and the tab tells you both before you confirm:

  1. It writes a new budget.journal beside your main journal, holding only a comment.
  2. It appends include budget.journal to the end of your main journal.

Ledgeline puts the include at the end because that is the only position that cannot change the meaning of anything already in the file. An include placed mid-file changes which directives are in force for everything after it.

Ledgeline refuses in two cases:

Once the file exists, new goals go there by default. You can move them anywhere hledger can read them, and Ledgeline will still find them.

Weekly, monthly, quarterly, annual

The tab groups your goals by how often they recur, such as “my monthly budget” or “what I expect to earn this year”. Each goal’s tooltip shows which ~ block it is in and which file holds that block, but the tab does not group by them.

Adding a goal puts it in the first writable rule of that period, in file order, whatever the rule is called. Ledgeline opens a new rule (~ monthly monthly budget) only when that period has no rule at all. If your monthly rule is called household budget, goals still go in it. Ledgeline never adds a goal to a read-only rule (see What Ledgeline will not rewrite), and opens a new rule instead. A journal edited through Ledgeline therefore tends toward one block per interval.

The tab knows which rule it means, because it has the list of rules. The engine works differently when asked for a goal under a period and a name. An API client makes that request, and so does the tab when it opens a new rule. The engine then adds the goal only to a rule matching both. --budget=DESCPAT filters on the description, so adding a goal to a rule of the right period but another name would change which filtered report it shows up in.

Spacing does not count when matching a rule. ~ monthly monthly budget and ~ monthly monthly budget are the same rule, because Ledgeline compares them with their whitespace collapsed. It normalises only the comparison. It never rewrites the header, and adding a goal to a rule adds its line and changes nothing else.

Each rule can have one goal per account. If you add a second goal for an account the rule already budgets, Ledgeline refuses and names the goal to edit instead. hledger would add the two lines together, so the second line would only be a harder-to-read way of changing the first.

hledger’s other two intervals, daily and quarterly, are read and edited normally. The tab just does not offer daily when creating a new rule.

Periods that are more than an interval

hledger’s period expressions go well beyond those five words. Ledgeline reads all of these, and counts each toward the bars the same way hledger does:

~ every 2 weeks  paycheck
~ biweekly  paycheck                    ; the same thing, spelled differently
~ every 15th day of month  rent
~ every 3rd tuesday of month  therapy
~ every 15th day  rent                  ; "of month" is optional
~ every 2nd monday  standup             ; the 2nd Monday of each month
~ every tuesday  coffee
~ every weekday  lunch                  ; Monday to Friday
~ every mon,wed,fri  gym
~ every 12/25  presents
~ every 1st Apr  renewal                ; also "every Apr 1st", "… of year"
~ quarterly from 2027  new lease
~ monthly from 2026 to 2028  car loan
~ monthly in 2027  this year only       ; also "monthly 2027"
~ monthly since 2027-03 to 2027-06      ; "since" means "from"
~ monthly until 2027-06                 ; "until" means "to", with no start
~ monthly 2027-01..2027-04  three months
~ 2027-03-01  one-off
~ 2027q2  one-off on April 1st

A date in a period can be a year (2027), a month (2027-03, 202703), a day (2027-03-15, 20270315) or a quarter (2027q2). Ledgeline does not read words like jan or this year, because their meaning changes from one day to the next.

Ledgeline follows these hledger rules exactly. They are easy to get wrong:

One known difference: ~ every 5th sunday of month (or any other fifth weekday) skips the months that have no fifth one. hledger moves those into the following month instead, in a pattern Ledgeline does not reproduce.

The tab shows these rules under Other periods, labelled with their own words, and they are read-only. The tab writes headers using one of the five plain interval words, so it cannot write every 2 weeks back. Edit those rules in your journal, and Ledgeline will keep reporting them.

If Ledgeline cannot parse a period expression at all, the tab still lists the rule exactly as written, but the rule adds no goals to the bars, and the tab says so. An unreadable period does not stop your journal opening. Earlier versions did fail: a single unreadable ~ header anywhere in a 40,000-line ledger stopped the whole file from loading.

Recent activity, and why it is subaccount-inclusive

When you set a goal, the last four periods of that account’s actual activity appear above the amount box, along with the current period and the average:

expenses:food — monthly

  Apr 2026   May 2026   Jun 2026   Jul 2026   Aug 2026 so far │ Average of 4
   $577       $612       $548       $701       $389           │   $609.50

These figures include subaccounts: expenses:food counts food:dining and food:groceries too. This makes the number comparable to the goal you are setting, because the budget report adds a parent’s goal up from its children and shows the parent’s actual including subaccounts. A figure that left subaccounts out would disagree with the bar it is meant to inform, and only for people who use subaccounts.

The current period is labelled “so far” rather than shown as a whole one.

The average covers complete periods only, and says how many: “Average of 4” above, not 5. Most people budget from this number, so it needs to stay stable. Including a month that is four days old would pull the average down by however far through the month you are, and that changes every day regardless of your spending. If no period has finished yet, the tab shows no average. That is different from an average of zero, and showing $0.00 would be wrong.

Each commodity is averaged on its own, over the same number of periods. A month in which a commodity did not appear still counts toward its average, as a month with zero spending in that commodity.

Income and the sign

hledger records income as negative. Ledgeline handles the sign for you. You type 1200 for an annual interest goal and the journal gets $-1200. The modal says so, and shows you the exact line before you save:

(income:interest)  $-1200

The flip also works in reverse. An income goal reads back as 1200 in the box, and its recent-activity figures and their average are shown positive, so the figures and the box agree about which way the numbers go.

Ledgeline decides whether an account is income from its declared type (account income:interest ; type: R) or from hledger’s own inference from the name. If you have an income account with an unusual name, declare its type and the tab will follow it.

What Ledgeline will not rewrite

Some rules are shown read-only, with a sentence saying why. They still count toward the report, but you cannot edit them from here. If Ledgeline cannot rewrite a rule safely, it leaves the rule for you to edit in your own editor rather than guessing.

You will seeBecause
the whole rule lockedits period says more than a plain interval (~ every 2 weeks, ~ every 15th day of month, ~ monthly from 2027)
the whole rule lockedLedgeline cannot work out how often its period recurs at all (~ every weekday)
the whole rule lockedit uses balanced-virtual [account] postings, which balance as a second group
the whole rule lockedits postings are not all in one commodity
one goal lockedit has no written amount, because hledger works it out from the other lines, so it changes when they do
one goal lockedits amount carries an @ cost annotation or a = balance assertion

The fifth row needs an example. In a rule like

~ monthly  budget
    expenses:food   $400
    assets:checking

the assets:checking leg has no number of its own, because hledger derives it. You only need to edit the food goal. hledger recalculates the other leg, and Ledgeline writes nothing to it.

Rules that balance explicitly

If every amount in a rule is written down, changing one would leave the rule unbalanced. Ledgeline therefore changes the counter-leg too, by exactly the difference:

~ monthly  budget
    expenses:food      $400     ← raise this to $450
    expenses:rent     $1500
    assets:checking  $-1900     ← and this becomes $-1950

The counter-leg is the one other posting whose amount has the opposite sign. If there is not exactly one, Ledgeline refuses rather than picking one, and tells you to edit that rule in your journal. Editing assets:checking above is an example, because both food and rent are candidates. Nothing in the file says whether food or rent should absorb the difference, and a guess could change someone’s budget without their noticing.

What an edit does to the rest of your file

Nothing. An edit rewrites bytes only inside the amount it names, and every other byte stays exactly as it was. Ledgeline does not reformat column alignment, comments or blank lines, so they stay as you wrote them. A new goal is padded to line up with the block it joins.

Before writing anything, Ledgeline re-parses your whole journal with the edited text in memory. It checks that the journal still parses and that the goal reads back as the number you typed. If either check fails, Ledgeline writes nothing.

If the file changed on disk since the tab loaded it (you edited it in vim, or another window saved), Ledgeline refuses the save with “reload and re-apply” rather than overwriting the other change.

Removing a goal

Removing a goal removes its line. Removing a rule’s last goal removes the whole rule, header and all, because hledger does not accept a bare ~ header with no postings.

Reading the bars

The Expenses table: one row per budgeted account and the Total under them, with one Remaining figure boxed

The table is hledger balance --budget in envelope form. It has one bullet bar per category, split into Income and Expenses. The goal marker shows your budget, and the fill shows what has actually happened.

The bars cover whole months. The engine counts month buckets backwards from the end of the range, so a range starting mid-month still starts its first bar on the 1st. The tab shows the real span under the heading. A category’s journal link uses that same span, so the transactions you open always add up to the bar you clicked.

Spending in another currency

A goal is in one commodity, such as $. If a category’s spending also includes another commodity, such as euros spent on a trip, Ledgeline converts it to the goal’s commodity before drawing the bar. It uses your journal’s P price directives, at the price in effect on the last day of the span. This matches what hledger balance --budget -V prints for the same dates. Prices implied by @ costs are not used, which is also hledger’s default. The goal itself is never converted.

If no price connects a commodity to the goal’s commodity, that part is left as it is. The row then shows both amounts, draws no bar, and says no price for EUR (or whichever commodity it is) under Remaining. Add a P directive for that commodity and the row gets its bar.

Pace: where you should be by now

Each bar has two marks. The tall, bright one is your goal for the whole span. It extends a little above and below the bar so you can still see it when the fill has gone past it. The fainter, half-height one is pace, the goal prorated to the days that have elapsed. For January to June of an annual budget, the pace mark is at the halfway point. For a period that has already finished, it is exactly on the goal.

The verdict is the text at the bar’s right end, under Remaining, and its colour. The bar’s own colour shows progress toward the goal, not pace; see The budget table.

TypeSituationLabelColour
Expenseat or under pace$X leftgreen
Expensepast pace, still under goal$X ahead of paceamber
Expensepast goal$X overred
Revenueat or past goal$X above targetgreen
Revenueat or past pace, under goal$X to gogreen
Revenueshort of pace$X behind paceamber

Income and expenses use the same rules in opposite directions. This fixed two earlier bugs. Earning more than your target used to turn the bar red and call it “over”. A half-year view of an annual expense goal used to report a large underspend that came only from the calendar.

Pace is prorated by days elapsed in the span, not by completed months. This makes a ~ yearly goal and twelve ~ monthly goals behave the same, since the engine has already combined both into one total for the span. It also stops a bar from changing colour on the 1st of the month when nothing about your spending has changed.

“Today” is your computer’s local date. The report engine never reads a clock. The page sends the date with the request (/api/budget?asOf=), so the server’s time zone cannot move a bar.

Pace is exact. The engine compares actual × days in span with goal × days elapsed, so a bar exactly on pace counts as on pace. The pace figure it reports (and quotes in “behind pace” / “ahead of pace”) is that ratio rounded to six decimal places past the goal’s own precision, far finer than any bar or label can show.

The budget table

Each section is a table with four columns:

ColumnWhat it shows
AccountThe category. Click it to open the journal filtered to that account for the same span.
BudgetedThe goal for the whole span. Click it to change the goal.
ActualWhat has happened so far, above the bar.
RemainingThe bar’s sentence ($170.00 left, $25.00 over, $400.00 behind pace), at the bar’s right end.

A Total row ends each section, under a rule. It sums the rows above it and can’t be edited.

On a narrow window (a phone, a half-screen window, or a large interface size) each row folds onto two lines: the account and its Budgeted amount on the first, then Actual and Remaining above the bar on the second. The Actual and Remaining headings are hidden there, because the figures over each bar say what they are. The fold happens when the table is narrower than 42rem, which scales with the interface size.

Editing from the Budgeted column. Hover or tab to a row and a pencil appears before its budgeted amount. On a touch screen the pencil is always shown, dimmed. The pencil and the amount are one button. What a click does depends on how many goals make up the figure:

A figure can be made of several goals for two reasons. Goals of different periods on one account add up, so a $50 monthly gift budget plus a $600 yearly one is one row. The depth slider also rolls accounts up. At depth 2, expenses:fun and expenses:fun:movies are both counted in the expenses:fun row, so both goals are listed behind it. In the list, a goal written on a subaccount shows that subaccount’s name under its period.

The goals list below the table shows only the goals the table has no row for, under the heading Other budget goals. There are two cases. The first is a goal on a parent account whose subaccounts have goals of their own, at a depth that shows those subaccounts. At depth 3, an expenses:fun goal sits beside an expenses:fun:movies row, and the bars show only the subaccount. The second is a goal on an account that is neither income nor expense. Add a budget goal stays at the top of the list. If every goal has a row, the list says so.

Bar colours in the table show how far along the goal a line is. The colour gradient spans the whole track, keyed to the goal marker, and the fill reveals the part you have reached:

The pace verdict is shown in the Remaining text. It is green when you are on the right side of pace, amber when you are not, and red only for an expense past its goal.

Ledgeline computes the orange from each theme’s own amber and red, so it matches whichever theme you use.

Ordering

One Sort by control, next to the depth slider, orders both the bars and the goals below them, so the two always appear in the same order. Sort by name or by amount, ascending or descending. The choice is saved in the URL like every other control on the tab.

Sorting by amount compares annualised figures, so weekly and yearly goals rank fairly against each other ($100 a week outranks $300 a month). Goals in a period Ledgeline does not model, and goals written in several commodities, have no single comparable figure, so they sort to the end. In the goals editor, the grouping by period stays as it is, and the sort applies inside each group.

What your budget does not cover

Under the bars is a collapsed section, Not budgeted. It lists the income and expense categories with activity in the same period, at the same depth, that no ~ rule mentions.

You don’t have to budget these. Budgeting some things and not others is a good way to work (clothing yes, insurance no). The section shows how much of your spending and income the bars leave out. Its header shows the count and the total, so you can tell whether it is worth opening without opening it.

Three rules decide what appears:

Ledgeline fetches the section only when you open it, so leaving it collapsed costs nothing.

See the income statement page for how Ledgeline resolves account types. The same type: rules decide which side of the budget an account appears on.