Skip to content

Instantly share code, notes, and snippets.

@chunhualiao
Created March 15, 2025 20:47
Show Gist options
  • Save chunhualiao/edc5ca4daa5cc2223d05d0abb499d22c to your computer and use it in GitHub Desktop.
Save chunhualiao/edc5ca4daa5cc2223d05d0abb499d22c to your computer and use it in GitHub Desktop.

Double-Entry Bookkeeping

Double-entry bookkeeping is an accounting system where every financial transaction is recorded in at least two different accounts. For each transaction, there must be:

  • A debit entry in one account
  • A credit entry in another account
  • The total debits must equal the total credits

For example, when a business purchases equipment for $5,000 in cash:

  • Equipment account is debited $5,000 (asset increase)
  • Cash account is credited $5,000 (asset decrease)

Why It's Needed

  1. Error Detection: Because debits must equal credits, mathematical errors become immediately apparent when accounts don't balance.

  2. Complete Financial Picture: It captures both where money came from and where it went, providing a comprehensive view of financial standing.

  3. Foundation for Financial Statements: It enables the creation of accurate balance sheets and income statements that properly reflect a company's financial position.

  4. Audit Trail: It creates a clear record that can be followed and verified, which is essential for auditing and compliance.

  5. Asset and Liability Tracking: It properly tracks what a company owns (assets) and what it owes (liabilities).

Without double-entry bookkeeping, businesses would struggle to maintain accurate financial records, detect errors, or generate reliable financial statements that investors, regulators, and managers need for decision-making.​​​​​​​​​​​​​​​​

@chunhualiao
Copy link
Author

Common Business Accounts for Double-Entry Bookkeeping

Account Type Examples Description
Assets Cash Money in bank accounts and on hand
Accounts Receivable Money owed to the business by customers
Inventory Goods available for sale
Prepaid Expenses Payments made for future expenses (insurance, rent)
Equipment Machinery, computers, vehicles, etc.
Buildings/Real Estate Property owned by the business
Liabilities Accounts Payable Money the business owes to suppliers
Notes Payable Formal debt obligations (loans)
Accrued Expenses Expenses incurred but not yet paid
Unearned Revenue Payments received for services not yet provided
Payroll Liabilities Taxes and wages owed to employees
Equity Owner's Capital Owner's investment in the business
Retained Earnings Accumulated profits kept in the business
Common Stock Shares issued to stockholders
Dividends Distributions to shareholders
Revenue Sales Revenue Income from selling goods or services
Service Revenue Income from providing services
Interest Income Income from investments or loans
Rental Income Income from renting property
Expenses Cost of Goods Sold Direct costs of items sold
Wages/Salaries Employee compensation
Rent Expense Payment for use of property
Utilities Electricity, water, internet, etc.
Advertising Marketing and promotion costs
Depreciation Allocation of asset costs over useful life
Insurance Coverage for various business risks
Interest Expense Cost of borrowing money

These accounts work together in the double-entry system to ensure that every transaction maintains the fundamental accounting equation: Assets = Liabilities + Equity.​​​​​​​​​​​​​​​​

@chunhualiao
Copy link
Author

I'll walk through a complete example of double-entry bookkeeping for a small coffee shop from startup through closure.​​​​​​​​​​​​​​​​

I've created a comprehensive example showing the complete lifecycle of a coffee shop business through double-entry bookkeeping. Here are some highlights from the example:

Key Phases Covered

Startup Phase

  • Initial owner investment
  • Taking out a business loan
  • Purchasing assets (building, equipment, inventory)
  • Prepaying expenses (insurance)

Operations Phase

  • Daily sales transactions (cash and credit)
  • Inventory usage and cost of goods sold
  • Employee wages and utility payments
  • Loan payments (principal and interest)
  • Depreciation of assets
  • Month-end closing entries

Closure Phase

  • Selling remaining inventory and assets
  • Recognizing gains/losses on sales
  • Paying off remaining liabilities
  • Final distribution to owner

Financial Reports

  • Trial Balance (showing all accounts balance)
  • Income Statement (showing profitability)
  • Balance Sheet (showing financial position)
  • Statement of Cash Flows (showing cash movement)

The example demonstrates the core principle of double-entry bookkeeping: for every transaction, debits always equal credits, maintaining the accounting equation (Assets = Liabilities + Equity).

Would you like me to explain any particular transaction or concept in more detail?​​​​​​​​​​​​​​​​

Double-Entry Bookkeeping: Complete Business Lifecycle Example

Morning Brew Coffee Shop

STARTUP PHASE

January 1, 2025: Owner invests $50,000 cash to start business

Account Debit Credit
Cash $50,000
Owner's Capital $50,000
Effect: Increases assets (Cash) and increases equity (Owner's Capital)

January 5: Secure business loan of $30,000

Account Debit Credit
Cash $30,000
Notes Payable $30,000
Effect: Increases assets (Cash) and increases liabilities (Notes Payable)

January 10: Purchase building for $60,000

Account Debit Credit
Building $60,000
Cash $60,000
Effect: Increases one asset (Building) and decreases another asset (Cash)

January 15: Purchase equipment for $15,000

Account Debit Credit
Equipment $15,000
Cash $15,000
Effect: Increases one asset (Equipment) and decreases another asset (Cash)

January 20: Purchase inventory (coffee beans, cups, etc.) for $5,000

Account Debit Credit
Inventory $5,000
Cash $5,000
Effect: Increases one asset (Inventory) and decreases another asset (Cash)

January 25: Pay for insurance, 1-year policy at $2,400

Account Debit Credit
Prepaid Insurance $2,400
Cash $2,400
Effect: Increases one asset (Prepaid Insurance) and decreases another asset (Cash)

OPERATIONS PHASE

February 1: Sales of coffee and pastries for day, $1,200 (70% cash, 30% credit card with 3% fee)

Account Debit Credit
Cash $840
Accounts Receivable $348.60
Credit Card Fees Expense $10.80
Sales Revenue $1,200
Effect: Increases assets (Cash, Accounts Receivable), increases expense (Credit Card Fees), increases revenue (Sales)

February 2: Receive credit card settlement from February 1 sales

Account Debit Credit
Cash $348.60
Accounts Receivable $348.60
Effect: Increases one asset (Cash) and decreases another asset (Accounts Receivable)

February 3: Use $500 of inventory for production

Account Debit Credit
Cost of Goods Sold $500
Inventory $500
Effect: Increases expense (COGS) and decreases asset (Inventory)

February 5: Pay employee wages, $800

Account Debit Credit
Wages Expense $800
Cash $800
Effect: Increases expense (Wages) and decreases asset (Cash)

February 10: Pay utility bill, $350

Account Debit Credit
Utilities Expense $350
Cash $350
Effect: Increases expense (Utilities) and decreases asset (Cash)

February 15: Monthly loan payment $1,100 ($900 principal, $200 interest)

Account Debit Credit
Notes Payable $900
Interest Expense $200
Cash $1,100
Effect: Decreases liability (Notes Payable), increases expense (Interest), decreases asset (Cash)

February 28: Record monthly depreciation

Account Debit Credit
Depreciation Expense - Building $100
Depreciation Expense - Equipment $125
Accumulated Depreciation - Building $100
Accumulated Depreciation - Equipment $125
Effect: Increases expenses (Depreciation) and increases contra-assets (Accumulated Depreciation)

February 28: Record monthly insurance expense

Account Debit Credit
Insurance Expense $200
Prepaid Insurance $200
Effect: Increases expense (Insurance) and decreases asset (Prepaid Insurance)

Month-End Entries

February 28: Closing Revenue accounts

Account Debit Credit
Sales Revenue $30,000
Income Summary $30,000
Effect: Zeroes out revenue accounts, transfers balance to Income Summary

February 28: Closing Expense accounts

Account Debit Credit
Income Summary $20,000
Cost of Goods Sold $12,000
Wages Expense $3,500
Utilities Expense $1,200
Credit Card Fees Expense $900
Interest Expense $200
Depreciation Expense - Building $100
Depreciation Expense - Equipment $125
Insurance Expense $200
Rent Expense $1,775
Effect: Zeroes out expense accounts, transfers balance to Income Summary

February 28: Closing Income Summary to Retained Earnings

Account Debit Credit
Income Summary $10,000
Retained Earnings $10,000
Effect: Zeroes out Income Summary, increases Retained Earnings by the net income amount

BUSINESS CLOSURE (After 1 Year)

December 31: Sell remaining inventory for $3,000 (cost basis $4,000)

Account Debit Credit
Cash $3,000
Loss on Inventory Sale $1,000
Inventory $4,000
Effect: Increases asset (Cash), records loss, decreases asset (Inventory)

December 31: Sell equipment for $8,000 (book value $10,500)

Account Debit Credit
Cash $8,000
Accumulated Depreciation - Equipment $4,500
Loss on Equipment Sale $2,500
Equipment $15,000
Effect: Increases asset (Cash), eliminates accumulated depreciation, records loss, eliminates asset (Equipment)

December 31: Sell building for $65,000 (book value $58,800)

Account Debit Credit
Cash $65,000
Accumulated Depreciation - Building $1,200
Building $60,000
Gain on Building Sale $6,200
Effect: Increases asset (Cash), eliminates accumulated depreciation, eliminates asset (Building), records gain

December 31: Pay off remaining loan balance of $20,000

Account Debit Credit
Notes Payable $20,000
Cash $20,000
Effect: Eliminates liability (Notes Payable), decreases asset (Cash)

December 31: Final distribution to owner of $77,000

Account Debit Credit
Owner's Capital $50,000
Retained Earnings $27,000
Cash $77,000
Effect: Eliminates equity accounts, decreases asset (Cash)

Final Balance Sheet (After All Closure Entries)

All accounts should have zero balances, confirming that the books balance.

Key Financial Reports Throughout the Business

Trial Balance (Sample - End of February)

Account Debit Credit
Cash $23,538.60
Inventory $4,500
Prepaid Insurance $2,200
Building $60,000
Accumulated Depreciation - Building $100
Equipment $15,000
Accumulated Depreciation - Equipment $125
Notes Payable $29,100
Owner's Capital $50,000
Retained Earnings $10,000
Sales Revenue $30,000
Cost of Goods Sold $12,000
Wages Expense $3,500
Utilities Expense $1,200
Credit Card Fees Expense $900
Interest Expense $200
Depreciation Expense - Building $100
Depreciation Expense - Equipment $125
Insurance Expense $200
Rent Expense $1,775
TOTAL $125,238.60 $125,238.60
Note: Debits = Credits, confirming the books balance

Income Statement (February)

Item Amount
Revenue
Sales Revenue $30,000
Total Revenue $30,000
Expenses
Cost of Goods Sold $12,000
Wages Expense $3,500
Rent Expense $1,775
Utilities Expense $1,200
Credit Card Fees Expense $900
Interest Expense $200
Insurance Expense $200
Depreciation Expense $225
Total Expenses $20,000
Net Income $10,000

Balance Sheet (End of February)

ASSETS LIABILITIES & EQUITY
Current Assets Liabilities
Cash $23,538.60 Notes Payable $29,100
Inventory $4,500 Total Liabilities $29,100
Prepaid Insurance $2,200
Total Current Assets $30,238.60 Equity
Owner's Capital $50,000
Non-Current Assets Retained Earnings $10,000
Building $60,000 Total Equity $60,000
Less: Accumulated Depreciation ($100)
Equipment $15,000
Less: Accumulated Depreciation ($125)
Total Non-Current Assets $74,775
TOTAL ASSETS $105,013.60 TOTAL LIABILITIES & EQUITY $89,100

Statement of Cash Flows (February)

Item Amount
Operating Activities
Net Income $10,000
Adjustments for non-cash items:
Depreciation $225
Changes in working capital:
Decrease in Inventory $500
Decrease in Prepaid Insurance $200
Net Cash from Operating Activities $10,925
Investing Activities
No investing activities in February $0
Net Cash from Investing Activities $0
Financing Activities
Loan Principal Payment ($900)
Net Cash from Financing Activities ($900)
Net Increase in Cash $10,025
Beginning Cash Balance $13,513.60
Ending Cash Balance $23,538.60

@chunhualiao
Copy link
Author

For example, when a business purchases equipment for $5,000 in cash:

Equipment account is debited $5,000 (asset increase)
Cash account is credited $5,000 (asset decrease)

Why is it not the opposite; cash account is debited and Equipment account is credit?

Great question! This gets to the heart of how debits and credits work in accounting.

In accounting, "debit" and "credit" don't inherently mean increase or decrease. Instead, whether a debit or credit increases or decreases an account depends on the account type.

Here's how it works:

Account Type Debit Effect Credit Effect
Assets Increase Decrease
Liabilities Decrease Increase
Equity Decrease Increase
Revenue Decrease Increase
Expenses Increase Decrease

So in your example:

  • Equipment is an asset account. Assets increase with debits, so we debit Equipment $5,000.
  • Cash is also an asset account. Assets decrease with credits, so we credit Cash $5,000.

This might seem counterintuitive at first, but the system is designed to maintain the accounting equation: Assets = Liabilities + Equity.

Think of it as two sides of a balance scale:

  • Asset accounts normally have debit balances (left side of the equation)
  • Liability and equity accounts normally have credit balances (right side of the equation)

When you record a transaction, you're keeping that scale balanced by making equal entries on both sides.​​​​​​​​​​​​​​​​

@chunhualiao
Copy link
Author

Assets = Liabilities + Equity.​​​​​​​​​​​​​​​​ But we also have expenses and revenue accounts. What are not they included in the formula?

Excellent question! Revenue and expense accounts are actually part of equity, but they're kept separate during the accounting period for better tracking and reporting.

Here's the expanded view:

Complete Accounting Equation:

Assets = Liabilities + (Owner's Capital + Retained Earnings + Revenue - Expenses)

The parenthesized part represents total equity. Revenue and expenses are technically temporary equity accounts that affect the Retained Earnings component.

What happens with Revenue and Expenses:

  1. During the accounting period:

    • Revenue increases equity (credited)
    • Expenses decrease equity (debited)
    • They're kept separate to track performance
  2. At period end (closing process):

    • Revenue and expense accounts are zeroed out
    • Their net impact (Net Income = Revenue - Expenses) is transferred to Retained Earnings
    • This process is called "closing the books"

So while the basic equation Assets = Liabilities + Equity is always true, revenue and expenses are tracked separately throughout the period to measure performance, then absorbed into equity (via Retained Earnings) at period end.

This is why income statements show a specific time period's performance, while balance sheets represent the cumulative position at a specific point in time.​​​​​​​​​​​​​​​​

@chunhualiao
Copy link
Author

Top 10 Beginner Double-Entry Bookkeeping FAQs

1. Why do debits have to equal credits?

Answer: Debits equaling credits maintains the accounting equation (Assets = Liabilities + Equity). This balance ensures that all resources are properly accounted for and the financial position is accurately represented. It's the foundation of the double-entry system that prevents mathematical errors.

2. How do I know which account to debit and which to credit?

Answer: Follow these rules:

  • Assets increase with debits, decrease with credits
  • Liabilities increase with credits, decrease with debits
  • Equity increases with credits, decreases with debits
  • Revenue increases with credits, decreases with debits
  • Expenses increase with debits, decrease with credits
    When in doubt, analyze how the transaction affects the accounting equation.

3. What's the difference between accrual and cash accounting?

Answer: Cash accounting records transactions only when cash changes hands. Accrual accounting records transactions when they occur economically, regardless of when cash moves. Accrual better reflects business performance by matching revenues with related expenses in the same period.

4. What is a journal entry?

Answer: A journal entry is the initial recording of a transaction, showing all accounts affected with their respective debits and credits. It includes the date, accounts involved, amounts, and often a brief description explaining the transaction's purpose.

5. What is a trial balance?

Answer: A trial balance is a worksheet listing all accounts with their debit or credit balances to verify that total debits equal total credits. It's typically prepared at the end of an accounting period to check for mathematical accuracy before creating financial statements.

6. How do adjusting entries work?

Answer: Adjusting entries update accounts at period-end to ensure revenues and expenses are recognized in the correct period. Common adjustments include:

  • Recording depreciation
  • Recognizing prepaid expenses used
  • Accruing unpaid expenses
  • Recording unearned revenue that's been earned

7. What happens when I make an accounting error?

Answer: For errors that don't affect the trial balance (like recording to wrong accounts), make a correcting entry. For errors that do affect the trial balance, find and fix the specific mistake. Never erase or delete entries; always correct with proper documentation.

8. What's the difference between the general journal and general ledger?

Answer: The general journal chronologically records all transactions with debits, credits, and explanations. The general ledger organizes these entries by account, showing running balances. Entries are first recorded in the journal, then posted (transferred) to the ledger.

9. How do closing entries work?

Answer: Closing entries transfer balances from temporary accounts (revenue, expense, dividend) to permanent accounts (retained earnings) at period-end. This process:

  1. Zeros out all revenue/expense accounts
  2. Updates retained earnings with net income/loss
  3. Prepares temporary accounts for the next period

10. What's the difference between a balance sheet and income statement?

Answer: The balance sheet shows the company's financial position (assets, liabilities, equity) at a specific point in time. The income statement shows performance (revenues, expenses, profit/loss) over a period of time. The balance sheet is cumulative, while the income statement covers only the specified period.​​​​​​​​​​​​​​​​

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment