A beginner’s take on double-entry bookkeeping.

Most accountants are probably familiar with the concept of double-entry bookkeeping, but most software developers less so. Which of course can be a problem if you’re trying to develop, fix, or otherwise work with double-entry bookkeeping software.

While by no means comprehensive, I hope the following description, with a simplified example, will provide some insight.

Accounts (also known as a ledgers) are somewhere that money (or something equivalent to money) can come from or go to – some place and form in which “money” can exist.

In double-entry bookkeeping, money always “comes from” somewhere and “goes to” somewhere – in other words, every transaction will be a debit in one table and a credit of equal value in another table. If the total debits across all of your tables is not equal to the total credit across all of your tables, something has gone wrong.

In this example, we invested £100 into the company. Then we used £60 to buy stock. We then managed to sell some of that stock to one of our customers (whose ID number is 26). The stock we sold cost us £40 to buy, but we manage to sell it for £80. I’ve used tables to represent accounts and connecting lines to represent transactions.

Double-entry bookkeeping example

There are various ways to categorise tables, but for this I'm using Expenses, Income, Assets, and Liabilities. Expenses are where money leaves the company, Income is where it comes in. Assets are whatever the company puts money into, with the expectation of being able to get it back out again later, and Liabilities are whatever the company takes money out of, with the expectation that it will have to go back in again later. When we owe money, that is often represented as an expense (the money we owe) and a liability (the fact that we haven’t paid it yet).

As a general rule to remember, when “adding to” an expense or asset, the value goes in the debit column (because we are “putting money in”), and where “adding to” an income or liability, the value goes in the credit column (because we are “taking money out”).

Capital represents money that has come from investors – in effect, money which the company owes to it’s shareholders. It is therefore a liability, and the £100 is listed as a credit in the capital table.

Our bank balance is an asset – we need to put money in before we take it out. The £100 start-up capital is put into our bank account, so that’s a debit. The £60 spent on stock comes out of our bank account, so that’s a credit. The £80 made in sales goes into our account, so that’s a debit.

COGS is “Cost Of Goods Sold” – the “cost” to us of selling goods. £40 worth of stock has gone from our company – in other words, it’s an expense. The £80 that the customer has agreed to pay for it comes from the sales account, which is income.

There’s quite possibly going to be a gap between a customer agreeing to pay for something, and actually putting money in our account (depending on how the business works), so when we make the sale the customer will owe us £80 – in other words, the customer’s debt is an asset. When the customer pays us, £80 is removed from that asset and put into our bank account.