Plain text accounting



Plain Text Accounting (PTA) means doing accounting with plain text data formats and scriptable software

Beancount does not represent time, only dates. The minimal time interval is one day.

Most (not all) plain text accounting implementations use signed amounts instead of debits and credits. It has been a rather successful simplification, intuitive to most newcomers. It is also by far the preferred way to export a trial balance or general ledger account from any system to excel. It is the norm in the accounting industry.

Syntax directives

  • Open a new account. Accounts must be opened before being referenced.

    2018-09-27 open Assets:EUR:Cash
  • Close an account. No transactions may post here after this date.

    2017-02-28 close Assets:EUR:BankAccount
  • Transactions

    • A basic transaction txn looks like this. Each line below a transaction is called a posting.
    2019-08-05 txn "Coffee"
      Assets:EUR:Cash     -1.20 EUR
      Expenses:Coffee     1.20 EUR
    • The sum of all postings must be 0. You may leave out one amount which will automatically get calculated
    2019-08-12 txn "Supermarket"
      Assets:EUR:Cash     -17.85 EUR
    • Instead of the keyword txn, you may use a flag to indicate a transaction. There are two available flags * and !
    ; This is a complete transaction
    2019-08-13 * "Train to work"
      Assets:EUR:Cash                 -2.50 EUR
    ; This is an incomplete transaction
    2019-08-13 ! "Bus to Susan's House"
      Assets:EUR:Bank                 -2.00 EUR
    • It’s also possible to flag a single posting in a transaction:
    2019-07-28 * "Concert Ticket Gorillaz"
      ! Assets:EUR:Bank                 -47.00 EUR
  • Define the price of a commodity for a given date

    2019-08-06 price A0MW0M 5.41 EUR
  • Transactions can also be linked together

    2014-02-05 * "Invoice for January" ^invoice-pepe-studios-jan14
    Income:Clients:PepeStudios           -8450.00 USD
    2014-02-20 * "Check deposit - payment from Pepe" ^invoice-pepe-studios-jan14
    Assets:BofA:Checking                  8450.00 USD
  • A Note directive is used to attach a dated comment to the journal of a particular account

    2013-11-03 note Liabilities:CreditCard "Called about fraudulent card."
  • A Document directive can be used to attach an external file to the journal of an account

    2013-11-03 document Liabilities:CreditCard "/home/joe/stmts/apr-2014.pdf"

We can rename the account name

; Options pour renommer les catégories de base
option "name_assets" "Actif"
option "name_liabilities" "Passif"
option "name_equity" "Capital"
option "name_income" "Recettes"
option "name_expenses" "Depenses"
option "account_previous_balances" "SoldeOuverture"
option "account_previous_earnings" "Benefice:Precedents"
option "account_current_earnings" "Benefice:Courant"

So the printed balance sheet would be displayed as follows. beancount-renamed

Formatting is critical

  • Indent the second and following lines of each transaction. The first line of each transaction needs to be flush left.
  • you need at least two spaces between the category ”Expenses:Household,” below) and the amount of the transaction (“20.00 USD”)
    2017/01/15 Acme

Currencies must be entirely in capital letters (allowing numbers and some special characters, like “_” or “-”). Currency symbols (such as $ or €) are not supported. The syntax for a currency is a word all in capital letters like "USD, CAD, MSFT"

In beancount, a comment is declared by a semicolon ;. Any text on a line after the character ; is ignored.