How does the double entry accounting system work?

Double-entry bookkeeping is an accounting system where every transaction is recorded in two accounts: a debit to one account and a credit to another. For example, if a business takes out a $5,000 loan, the cash (asset) account is debited to $5,000 and the outstanding debt (liability) account is credited $5000.