Technical
Account Number Validation: Beyond Basic Format Checking
A routing number follows a single national standard, so software can check it with confidence. An account number is a different story. Each bank decides how to number its accounts, and there is no universal checksum that works across all of them. That makes account number validation a matter of sensible format checks plus, when it matters, real verification. This guide explains the difference and shows how to do each part well.
What an account number is
In the United States, an account number identifies one account within one financial institution. Together with the nine-digit routing number, it tells the payment system exactly where to send or collect money. The ACH network allows up to 17 characters for the field, and most account numbers are made up of digits only, but length and internal structure vary between institutions. Some banks embed a branch code, an account type or their own check digit, and each one does it differently.
What you can safely check
Because the rules differ, a general-purpose tool should stick to checks that are true for almost everyone:
- Characters. The input should contain digits only, once spaces and hyphens have been removed.
- Length. A practical range of 6 to 17 digits covers the great majority of US accounts. Tvalidora uses this range, and it is worth knowing that a small number of institutions issue shorter numbers, so a strict minimum can occasionally reject a genuine one.
- Consistency. The value should not be empty, all zeros or an obvious placeholder.
- Confirmation. Asking the customer to type the number twice is a simple and effective way to catch slips.
These checks cost nothing, run instantly in the browser and prevent most data-entry accidents. Our account format checker does exactly this and nothing more: it does not contact any bank, and it does not store what you type.
A simple validation snippet
function checkAccountFormat(value) {
// Keep it as a string: leading zeros are meaningful.
const account = String(value).replace(/[\s-]/g, "");
if (!/^\d+$/.test(account)) {
return { ok: false, reason: "Use digits only." };
}
if (account.length < 6 || account.length > 17) {
return { ok: false, reason: "Account numbers are usually 6 to 17 digits." };
}
return { ok: true, value: account };
} The comment in the first line matters. Never convert an account number to an integer. Leading zeros are part of the number, and long values can exceed the safe integer range in JavaScript, which silently changes the last digits.
What a format check cannot prove
An account number can look perfect and still be useless. A format check cannot tell you that:
- the account exists, is open, or is not frozen,
- the account belongs to the person filling in the form,
- the account is the right type, for example checking rather than a loan account, or
- the routing number and account number actually belong together.
The last point is easy to overlook. Each number can pass its own checks while the pair is wrong, for instance when a customer pastes the right account number with an old routing number. Format validation is a filter for typing errors and no more than that.
Methods that verify an account
When you need to be sure, you must go beyond format and use a method that involves the bank or the account holder:
- Micro-deposits. You send two very small deposits, usually a few cents, and ask the customer to report the amounts after they appear in their account. Seeing them proves they control the account. It takes a day or two.
- Prenotification. The ACH system supports a zero-dollar “prenote” entry that lets the receiving bank confirm that the account number is valid before a real payment is sent.
- Instant account verification. The customer signs in to their bank through a secure, authorized connection and the bank confirms the account details directly.
- Name matching and manual review. Some businesses compare the account holder name returned by their bank or processor to the name on their own record.
Rules for web-initiated ACH debits require originators to use a commercially reasonable fraud detection system that includes account validation, and Nacha, the organization that maintains the ACH rules, publishes the details on its official website. If you take payments this way, read the current rules or ask your payment provider which method they support.
Designing a good account number form
- Label fields clearly. Show a short image or sentence explaining where the routing and account numbers appear on a check or in a banking app.
- Use text inputs. A numeric spinner can strip leading zeros, so use a text input with
inputmode="numeric", which still brings up a number pad on phones. - Validate gently. Check as the customer leaves the field, not on every keystroke, and write messages that explain how to fix the problem.
- Protect the data. Do not write account numbers into logs, analytics events or error reports.
- Verify before the first debit. Treat format validation as the first step and a real verification method as the second.
What about international accounts?
Outside the United States, many countries use the IBAN, which includes its own country code and a two-digit check number that does work as a universal checksum. Tvalidora currently focuses on US routing and account formats, and we plan to expand to international codes. Until then, always follow your bank’s guidance for international transfers. You can find answers to common questions in our FAQ.
Key takeaways
There is no universal checksum for US account numbers, so format validation is limited to digits, a sensible length range and a double entry. Treat those checks as a courtesy that catches typos and saves everyone time. When money or identity matters, use micro-deposits, prenotes or an instant verification service to confirm that the account is real and belongs to your customer. Keep the number as a string, protect it carefully, and never assume that a well-formed number is a working account.
Put it into practice: check the format of a card, routing or account number with the Tvalidora validator, look up an area code or zip code with the US Checker, or read the FAQ to see exactly what a “valid” result means. Tvalidora checks number format only, and never stores what you enter.