Fork of ball-hayden/uk_account_validator maintained by Residently to keep the modulus checking data up to date.
This gem validates UK account numbers against their sort codes in accordance with VocaLink's modulus checking specification, which can be downloaded from here.
Note that this gem ensures the sort code and account number are valid, not that they exist.
The resource text files valacdos.txt and scsubtab.txt are produced and released by VocaLink.
Requires Ruby > 2.0.0
valacdos.txt(modulus weight table): https://www.vocalink.com/media/jsjlwqy5/valacdos.txtscsubtab.txt(sort code substitution table): https://www.vocalink.com/media/tedlwtxz/scsubtab.txt
VocaLink publishes updates roughly quarterly. Last updated: 2026-07-06.
UkAccountValidator::Validator.new(sort_code, account_number).valid?or
validator = UkAccountValidator::Validator.new
validator.account_number = account_number
validator.sort_code = sort_code
validator.valid?Add this line to your application's Gemfile:
gem 'uk_account_validator', github: 'residently/uk_account_validator'And then execute:
$ bundle
- Download the latest
valacdos.txtfrom the VocaLink link above - Replace
data/valacdos.txt - Commit and push