Regex for IFSC code (bank branch)
An IFSC identifies a bank branch for NEFT, RTGS and IMPS transfers. It is 11 characters: four letters for the bank, a zero reserved for future use, and six characters for the branch.
The pattern
/\b[A-Z]{4}0[A-Z0-9]{6}\b/gThe tester opens with this pattern and the examples below already loaded. Nothing you type is uploaded.
How it works
[A-Z]{4}- Bank code, for example SBIN or HDFC.
0- The fifth character is always zero.
[A-Z0-9]{6}- Branch code, letters or digits.
Examples
Matches
SBIN0001234HDFC0000123ICIC0006789
Does not match
SBIN1001234SBI0001234sbin0001234
Use it in JavaScript
const re = /\b[A-Z]{4}0[A-Z0-9]{6}\b/g;
// Find every match in a block of text
const found = text.match(re);
// Validate that a whole value matches (no stray characters around it)
const exact = new RegExp('^(?:' + re.source + ')$', re.flags.replace('g', ''));
const isValid = exact.test(value);Limits and tips
- The pattern confirms the format, not that the branch exists. Use a bank-branch lookup if you need to verify it.
- Uppercase the user’s input before testing so that lowercase entries are accepted.
Frequently asked questions
What is the IFSC code format?
Four letters, the digit 0, then six letters or digits, 11 characters in total.
Is the fifth character always zero?
Yes, it is reserved and is a zero in every IFSC, so the pattern hard-codes it.