Skip to content
stmtai

How-to

How to categorise bank transactions automatically

How bank rules work in QuickBooks Online and Xero, how to write ones that keep working, what to do with lines they miss, and how to check the result.

7 min read · Last reviewed · by the stmtai team

Most bank transactions can be categorised by a rule that looks at the description and, sometimes, the amount. Your accounting software already has this feature. QuickBooks Online calls them bank rules; so does Xero. Set up rules for the twenty or thirty payees that make up the bulk of your lines, review whatever the rules do not catch, and add a rule each time you see the same unmatched payee twice. Within three months, most of the coding is done before you look at it.

This guide covers how those rules work, how to write ones that keep working, what to do with the lines rules cannot place, and how to check the result. Nothing categorises everything correctly, and the lines that get it wrong are the expensive ones.

Start with the chart of accounts, not the rules

A rule assigns a category, so the categories have to exist first. The default chart of accounts that QuickBooks Online or Xero creates for a new business is a reasonable start. It already has accounts for the ordinary things: advertising, bank fees, insurance, office costs, rent, subscriptions, travel, utilities, wages.

Before writing a single rule, go through that list and do three things.

  • Remove or hide accounts you will never use. Every spare account is a place for a transaction to be miscoded.
  • Add the two or three that are specific to your business. A courier has vehicle costs and tolls.
  • Decide the ambiguous ones now. Does a laptop go to equipment or office costs? Is a working lunch meals or travel? Write the answer down. Rules only encode decisions you have already made.

Twenty to thirty expense accounts is enough for most small businesses. More than fifty and you will spend your time deciding between near-identical categories rather than reading the numbers.

How bank rules work

Both QuickBooks Online and Xero apply rules to lines coming in from the bank feed or from an imported statement file, before you confirm them. The mechanics differ slightly. The details below were checked in September 2026 and may drift as the products change.

QuickBooks Online

A rule applies to money in or money out, for one bank account or all of them. It has up to five conditions on the description, the raw bank text or the amount, each using "contains", "doesn't contain" or "is exactly", and it sets the transaction type, category, payee and tags. Rules are ordered, and the first rule that matches wins, so specific rules go above general ones. You can have up to 2,000 rules.

By default a matched transaction sits in the For review tab with a RULE badge, waiting for you to confirm it. Each rule also has an auto-add option that posts matching lines straight into the books. Use that only for lines that are identical every time, such as rent or a loan repayment, and even then look at the totals monthly.

One thing catches people out. QuickBooks shows a simplified description by default and keeps the full bank text separately. A rule written against one will not fire on the other. If a rule that looks right is not matching, switch the transactions list to show the full bank description and compare.

Xero

A rule in Xero can match on payee, description, reference, amount, or any text field, using "any" or "all" of its conditions. It codes the line to an account, a tax rate and a contact. Matching lines then appear on the reconcile screen with the coding filled in and a green "OK" button; nothing is posted until you click it. The quickest way to create one is from the reconcile screen itself: find a line you have just coded by hand, open Options and choose Create bank rule, and the conditions are pre-filled from that line.

Xero also remembers how you coded a payee last time and suggests the same again. That is a suggestion, not a rule, and it can be wrong when the same payee sells you different things.

Writing rules that keep working

Match on the stable part of the description. Card descriptions carry a merchant name plus a store number, a city and a reference that changes every time. "Contains AMAZON" keeps working; "is exactly AMAZON MKTPLACE US*2K4TR7" fires once.

Watch for the same merchant under two names. Card processors abbreviate. The utility company might appear as its full name from a direct debit and as a six-letter code from a card payment. Two rules, or one rule with two "contains" conditions joined by "any".

Use the amount when the description is useless. A payment processor payout that is always the same figure, a loan repayment, a subscription. "Description contains PAYPAL and amount is exactly 49.00" separates your software subscription from the other things you buy through PayPal.

Do not write a rule for a payee you have seen once. Rules are for recurrence. A one-off gets coded by hand and forgotten.

Put specific before general. If both "contains AMAZON WEB SERVICES" (hosting) and "contains AMAZON" (office costs) exist, the hosting rule has to come first or every AWS bill lands in office costs.

Check the rules list twice a year. Payees change names, subscriptions stop, and a rule that no longer matches anything is harmless, but one that matches the wrong thing is not.

What rules cannot do

There are four kinds of line no rule handles well, and they need to be reviewed by a person each time.

Ambiguous merchants. A large retailer sells office paper and birthday presents. A payment processor sits in front of thousands of sellers. The description tells you who took the money, not what it was for. The receipt tells you that, and the line has to wait until you have it.

Transfers. Money moved between your own accounts is not income or expense, and a rule that codes a savings transfer as revenue quietly inflates your sales. Both QuickBooks Online and Xero can match a transfer against the other account's side if both accounts are in the software. Where they are not, code it to a transfer or clearing account, never to a profit and loss category.

Refunds. A refund from a supplier is a negative expense in the same category as the original purchase, not income. The description usually looks exactly like the purchase it reverses, so a description rule sends it to the right account but the software has to be told it is money in, not money out. Check that your rules for money in do not include supplier names.

Owner and personal spending. In a small business, personal items go through the business card. Rules cannot tell your lunch from a client's. Code those by hand to drawings or the director's loan account, and make the rule set smaller rather than trying to encode your habits.

A weekly routine

Rules reduce the work; someone still has to look. This is the shortest routine that keeps the books honest.

WhenWhatAbout how long
WeeklyConfirm the lines the rules coded. Read the descriptions as you go; do not just click through.10 to 15 minutes
WeeklyCode the unmatched lines by hand. Any payee seen twice in a month gets a rule.5 to 10 minutes
MonthlyRead the profit and loss by category. A category that doubled, or one you do not recognise, means a rule is misfiring.15 minutes
MonthlyReconcile every account to its statement. Coding is not reconciliation; see the bank reconciliation guide.20 to 30 minutes per account

Categorising outside the accounting software

If you are working in a spreadsheet instead, either because there is no accounting software yet or because you are cleaning up a year of statements before importing them, the same principles apply, with cruder tools. A column of categories filled by a lookup on keywords in the description does most of the work; a filter for blanks shows you what is left to code by hand.

Statement converters can give you a head start here. When stmtai converts a PDF statement, it adds a suggested category to every row from a fixed list of 22 generic headings such as Utilities, Payroll, Fees & Interest and Transfer. These are deliberately not a chart of accounts; they are hints for someone sorting rows in Excel, and you can change any of them in the table before you export. The QuickBooks and Xero export files leave categorisation to those programs' own rules on import, which is where it belongs. See convert a bank statement to Excel for what the spreadsheet looks like, or convert a bank statement to QuickBooks for the import route.

How to tell whether it is working

Three signs the categorisation is good enough.

  • Fewer than one line in ten needs coding by hand each week, and that number is falling.
  • The monthly profit and loss looks like the business you run. If "Other" or "Ask my accountant" is one of your larger categories, the rules are too coarse.
  • Your accountant does not send back a list of recodes at year end. That list is the true measure of how well the year was categorised, so ask for it.

None of this requires machine learning. The rules are yours, they do what you told them, and when a line is wrong you can see which rule put it there. That is the point.

Questions

Should I turn on auto-add so rules post transactions without my review?

Only for lines that are identical every month, such as rent, a lease payment or a fixed loan repayment, where a wrong posting would be obvious on the profit and loss. Leave card purchases and anything with a variable amount in the review queue. A rule that auto-posts a wrong category every week for a year is harder to undo than a few seconds of confirming.

If I import a statement file instead of using a bank feed, do the rules still apply?

Yes. Both QuickBooks Online and Xero run bank rules on imported statement lines the same way they do on feed lines, and the lines wait in the same review or reconcile screen. The rules match on the description and amount in the file, so a converter that preserves the bank's original description gives the rules more to work with.

Can a rule split one transaction across two categories?

QuickBooks Online rules can split a matched line by fixed amounts or percentages, which suits a combined bill such as a phone and internet package with a stable price. Xero rules can also allocate a line across several account codes by percentage or fixed amount. Splits by percentage go wrong when the total changes, so review them.

How do I stop QuickBooks or Xero coding my savings transfer as income?

Add the savings account to the software so the transfer can be matched to its other side, or write a rule that codes lines containing the transfer reference to a transfer or clearing account rather than to a revenue account. Then check the revenue line on the profit and loss against your sales records each month.

Do I need a separate category for every supplier?

No. Categories describe what the money was for, not who received it. The supplier is recorded as the payee or contact on the line, so you can still report spend by supplier later. Keeping categories to a few dozen is what makes the profit and loss readable.

Related guides

All guides · All banks and formats