iLearnFintech Glossary Formulas Cases Sandboxes
Accounting/Basics

Double-entry bookkeeping

7 min readCoreUpdated December 2026

This lesson uses our case company, Fernway Bikes.

In short

Every transaction is recorded twice: once where the value comes from and once where it goes. That simple rule keeps the balance sheet in balance and makes errors much easier to find.

What it is

Accounting keeps a separate record, called an account, for each kind of item: cash, machines, bank loans, revenue, wages and so on. Every transaction changes at least two accounts by the same amount. One side is called the debit and the other the credit.

  • Assets and expenses increase with a debit.
  • Liabilities, equity and revenue increase with a credit.

Transactions are first written in a journal in date order, then posted to the accounts in the ledger. A trial balance lists all accounts; total debits must equal total credits.

Debit and credit are not good and bad. They are just the left and right side of an account. A debit to cash means more cash; a debit to a loan account means less debt.

The intuition

Value never appears from nowhere and never just disappears. If a company buys a machine for cash, it has more machines and less cash. If it borrows, it has more cash and more debt. Double entry simply writes down both halves of every story.

For data people: a ledger is just a table of transactions. Each row has a date, an account, an amount and a side. Every financial statement is a group-by and a sum over that table.

The math

\[\text{Assets} = \text{Liabilities} + \text{Equity}\]
\[\sum \text{Debits} = \sum \text{Credits}\]

In words: Because every transaction has equal debits and credits, the accounting equation stays true after every single entry.

An example

A new consultancy makes four transactions in its first month.

#TransactionDebitCreditAmount
1Owner puts in cashCashEquity50,000
2Buys laptops for cashEquipmentCash20,000
3Borrows from a bankCashBank loan30,000
4Sends an invoice for work doneReceivablesRevenue8,000

The balance sheet at month end: cash 60,000 + equipment 20,000 + receivables 8,000 = 88,000 of assets. On the other side: bank loan 30,000 + equity 50,000 + profit 8,000 = 88,000. It balances.

Cash DebitCreditOwner 50,000Loan 30,000Laptops 20,000Balance: 60,000 debitEquipment DebitCreditLaptops 20,000Balance: 20,000 debitBank loan DebitCreditCash 30,000Balance: 30,000 credit Every transaction has a debit and a credit of the same size
T-accounts for three of the consultancy's accounts after its first month. Buying the laptops is a credit to cash and a debit to equipment: one transaction, two entries.

In Python

A ledger is just a table. If debits are positive and credits negative, every correct journal sums to zero.

import pandas as pd

journal = pd.DataFrame([
    ("Cash", 50_000, "D"), ("Equity", 50_000, "C"),
    ("Equipment", 20_000, "D"), ("Cash", 20_000, "C"),
    ("Cash", 30_000, "D"), ("Bank loan", 30_000, "C"),
    ("Receivables", 8_000, "D"), ("Revenue", 8_000, "C"),
], columns=["account", "amount", "side"])

# debits positive, credits negative: the whole journal must sum to zero
journal["signed"] = journal["amount"].where(journal["side"] == "D", -journal["amount"])
print(journal["signed"].sum())                     # 0
print(journal.groupby("account")["signed"].sum())  # the trial balance

In the real world

Luca Pacioli, 1494

In 1494 the Italian mathematician Luca Pacioli published a book in Venice that described the bookkeeping method of the city's merchants. It is the first printed description of double-entry bookkeeping. Every account in this lesson still works the way he described it more than 500 years ago.

Think about it

Fernway Bikes buys parts for $2 million on credit and pays the supplier a month later. Write both transactions as debits and credits. What happens to total assets each time?

Show a model answer

Buying on credit: debit inventory 2, credit payables 2. Assets and liabilities both rise by 2. Paying the supplier: debit payables 2, credit cash 2. Assets and liabilities both fall by 2. The balance sheet balances after both steps, and no profit is recorded, because no value has been earned or used up yet.

Reading the result

Double entry catches many mistakes, but not all of them.

Good signs

  • Every entry has equal debits and credits
  • The trial balance totals agree
  • Accounts are reconciled with outside evidence, such as bank statements

Watch out

  • Books that balance can still be wrong: an amount posted to the wrong account still balances
  • A transaction left out completely leaves no trace in the totals
  • Reading debit as good and credit as bad

Remember

  • Every transaction touches at least two accounts.
  • Assets and expenses rise with debits; liabilities, equity and revenue rise with credits.
  • A ledger is a table; statements are sums of it.

Check yourself

Question 1 of 2A company buys goods for its shop for $5,000 and will pay the supplier next month. Which two accounts change?

Question 2 of 2What does a debit mean?

Read more

  • Kimmel, Weygandt & Kieso, Financial Accounting: Tools for Business Decision Making: chapter on the accounting information system

Spotted a mistake or have a wish?

Tell us in a line or two. The page name is sent along automatically.