What is NUBAN? A developer's guide to Nigerian account number validation
How the CBN NUBAN checksum algorithm works, how to validate Nigerian account numbers in code, and how to automate it via API.
Every Nigerian bank account number follows a 10-digit format governed by the Central Bank of Nigeria. That format is called NUBAN — Nigeria Uniform Bank Account Number. The last digit is not random: it is a checksum computed from the bank code and the first nine digits using a public algorithm. This means you can validate any NUBAN account number before making an API call, without needing any external service.
What is NUBAN?
NUBAN was introduced by the CBN in 2010 to standardise the account number format across all Nigerian banks. Before NUBAN, different banks used different account number lengths and formats, making interbank transfers error-prone. NUBAN mandates a 10-digit number for every account at every licensed Nigerian institution.
The standard has two components: the institution prefix (tied to a bank code) and a checksum digit as the 10th digit that allows any system to verify the number's structural validity before attempting a real lookup.
How the NUBAN checksum works
The algorithm is publicly documented by the CBN. Here is how it works:
| Step | Operation |
|---|---|
| 1 | Take the 3-digit bank code + first 9 digits of account = 12 digits |
| 2 | Multiply each digit by its weight from the series [3,7,3,3,7,3,3,7,3,3,7,3] |
| 3 | Sum all 12 products |
| 4 | Compute: (10 − (sum mod 10)) mod 10 = check digit |
| 5 | Compare check digit to the 10th digit of the account number |
Example: validating GTBank account 0123456789
Bank code: 058
Account: 0123456789
Combined: 058012345678 (bank code + first 9 digits)
Weights: [3, 7, 3, 3, 7, 3, 3, 7, 3, 3, 7, 3]
Products: [0,35, 0, 0, 7, 9, 9,14, 6,15, 0,24]
Sum: 119
Check digit: (10 - (119 % 10)) % 10 = (10 - 9) % 10 = 1
10th digit of account: 9
Result: INVALID (1 ≠ 9)Implementing the validator in JavaScript
const NUBAN_WEIGHTS = [3, 7, 3, 3, 7, 3, 3, 7, 3, 3, 7, 3];
function validateNuban(account: string, bankCode: string): boolean {
if (!/^\d{10}$/.test(account)) return false;
if (!/^\d{3,6}$/.test(bankCode)) return false;
const paddedBank = bankCode.padStart(3, "0").slice(0, 3);
const digits = (paddedBank + account).split("").map(Number);
const sum = digits
.slice(0, 12)
.reduce((acc, d, i) => acc + d * NUBAN_WEIGHTS[i], 0);
const checkDigit = (10 - (sum % 10)) % 10;
return checkDigit === Number(account[9]);
}
// Usage
console.log(validateNuban("0044563185", "058")); // true or falseUsing the Mansa API NUBAN validator
The Mansa API exposes the same checksum logic as a REST endpoint so your backend can validate without reimplementing the algorithm.
curl "https://mansaapi.com/api/v1/identity/nuban/validate?account=0123456789&bank_code=058" \
-H "Authorization: Bearer YOUR_API_KEY"{
"success": true,
"data": {
"account": "0123456789",
"bank_code": "058",
"valid": false,
"check_digit_expected": 1,
"check_digit_provided": 9
}
}Node.js SDK
import { MansaAPI } from "mansaapi";
const mansa = new MansaAPI({ apiKey: "mansa_live_sk_..." });
const result = await mansa.identity.validateNuban("0044563185", "058");
if (result.data.valid) {
// Proceed with transfer
} else {
// Reject: invalid account number format
}Free validator tool
Need to test a NUBAN without writing code? Use the free NUBAN validator tool. Enter any 10-digit account number and bank, and see the checksum calculation in real time — entirely in your browser, no data sent anywhere.