Skip to content

The maths behind the sort code checker, step by step

How Modulus Checking Works

Modulus checking is the arithmetic UK banks use to catch typos in a sort code and account number before a payment is sent. This page walks through exactly how the two general-purpose algorithms work, digit by digit, using the same official worked examples the sort code checker's own code is tested against.

Where this comes from

Both algorithms below are published by Vocalink (the company behind the UK's Bacs and Faster Payments infrastructure) in a free, public specification called "Validating Account Numbers – UK Modulus Checking". That specification defines the exact fourteen-digit layout – six sort code digits followed by eight account number digits – and two general-purpose weighting tables. It also defines hundreds of bank-specific exceptions with their own custom weight tables, which is licensed data outside the scope of this free explanation; see the note on scope at the end of this page.

Standard Modulus 11, step by step

Standard Modulus 11 only weights the account number digits, not the sort code – the sort code's six weight positions are all zero in the standard table. Using the specification's own worked example, sort code 18-00-02 and account number 98093517:

  1. Line up all fourteen digits: 1 8 0 0 0 2 (sort code) followed by 9 8 0 9 3 5 1 7 (account number).
  2. Multiply each digit by its fixed weight: the six sort code positions all use weight 0, and the eight account number positions use weights 8, 7, 6, 5, 4, 3, 2, 1 in order.
  3. That gives: 1×0=0, 8×0=0, 0×0=0, 0×0=0, 0×0=0, 2×0=0, 9×8=72, 8×7=56, 0×6=0, 9×5=45, 3×4=12, 5×3=15, 1×2=2, 7×1=7.
  4. Add all fourteen products together: 0+0+0+0+0+0+72+56+0+45+12+15+2+7 = 209.
  5. Divide the total by 11: 209 ÷ 11 = 19 with no remainder. Because the remainder is zero, this sort code and account number pass the check.

Double Alternate, step by step

Double Alternate weights every digit (sort code included), alternating between a weight of 2 and 1, and has one extra step: if multiplying a digit by 2 gives a two-digit result, its two digits are added together before the running total is taken. Using the specification's own second worked example, sort code 49-92-73 and account number 12345678:

  1. Line up all fourteen digits: 4 9 9 2 7 3 (sort code) followed by 1 2 3 4 5 6 7 8 (account number).
  2. Multiply each digit by an alternating weight starting at 2: 4×2=8, 9×1=9, 9×2=18, 2×1=2, 7×2=14, 3×1=3, 1×2=2, 2×1=2, 3×2=6, 4×1=4, 5×2=10, 6×1=6, 7×2=14, 8×1=8.
  3. Where a product is two digits, add those digits together: 18 becomes 1+8=9, 14 becomes 1+4=5, 10 becomes 1+0=1 (the single-digit products are left as they are).
  4. Add all fourteen resulting values together: 8+9+9+2+5+3+2+2+6+4+1+6+5+8 = 70.
  5. Divide the total by 10: 70 ÷ 10 = 7 with no remainder. Because the remainder is zero, this sort code and account number pass the check.

Why two different algorithms exist

Different UK banks were set up on different modulus checking methods historically, and Vocalink's specification preserves that rather than forcing every bank onto one formula. In practice this means a genuinely valid sort code and account number pair might only pass ONE of the two checks, not both – which is exactly why the sort code checker on this site runs both algorithms and reports a pass if either one succeeds, instead of requiring both. The bank each sort code belongs to comes from a separate lookup, not the modulus maths itself – see the UK bank sort codes list for that reference table.

A failing example, for comparison

To see what a genuine mismatch looks like: keep sort code 18-00-02 from the Standard-11 example above, but change the account number to 11111111. Repeating the same weighting (8,7,6,5,4,3,2,1 against 1,1,1,1,1,1,1,1) gives products of 8,7,6,5,4,3,2,1, which sum to 36. Dividing 36 by 11 gives 3 remainder 3 – not zero, so this combination fails the check. That non-zero remainder is precisely the signal that catches a mistyped digit in practice: a single wrong digit almost always changes the final remainder away from zero.

Scope: what this page (and the checker) does not cover

Vocalink's full specification defines a further ~700 sort-code-range exceptions, each with its own custom weight table or an extra rule layered on top of the two general methods shown above. That full dataset is licensed, paid data – it is what payment-processing companies buy access to. This page and the sort code checker deliberately only implement the two general-purpose, publicly documented algorithms, and say so plainly rather than quietly guessing at the exception rules. See the checker's own disclaimer for what that means in practice for an unusual sort code, and the privacy page for why none of this arithmetic ever needs to leave your browser in the first place.

Frequently asked questions

Do all UK sort codes use the same modulus check?
No. Most use either Standard Modulus 11 or Double Alternate (Modulus 10), and a meaningful number use a bank-specific weighting exception on top of one of those two. This page explains the two general methods; the full exception list is licensed data not covered here.
Why does the sort code get a weight of 0 in the Standard-11 example?
In the default Standard-11 weighting table, only the eight account number digits are weighted; the six sort code digit positions all carry a weight of 0, so they contribute nothing to the total. Some bank-specific exception tables do weight the sort code digits too, but that is outside the general-purpose table shown here.
What happens if a doubled digit is already a single digit?
It's used as-is. In Double Alternate, only products of 10 or more (i.e. a digit of 5-9 multiplied by 2) produce a two-digit result that needs its digits added together; a digit multiplied by 1, or a small digit multiplied by 2, stays a single number.
Can I run these calculations myself instead of using the checker?
Yes – the steps above are the complete calculation for both general-purpose checks. The sort code checker runs exactly this same maths automatically and also looks up the bank group for you.

Ready to check a real sort code?

Run the format check, modulus check and bank lookup in one screen.

Go to the sort code checker

Free. No sign-up.