PatternRegex

Validate an IFSC code

Confirm an IFSC code matches the RBI layout: a 4-letter bank code, a reserved zero, then a 6-character branch code.

Last updated

Pattern
^[A-Z]{4}0[A-Z0-9]{6}$
Open in Regex Tester & Builder

Matches

  • SBIN0001234
  • HDFC0000001

Doesn’t match

  • SBIN1001234
  • sbin0001234

Why it’s written this way

The first four characters, [A-Z]{4}, identify the bank — 'SBIN' for State Bank of India, 'HDFC' for HDFC Bank — and the fifth character is a literal 0, reserved by the RBI for future use rather than being part of the bank or branch code.

The remaining [A-Z0-9]{6} identifies the specific branch and is alphanumeric because several banks use letters in that segment, not only digits.

Edge cases to know

  • It confirms the code is shaped like a valid IFSC, not that the bank code or branch code actually exists — cross-check against the RBI's published list for that.
  • It's case-sensitive: real IFSC codes are issued uppercase, so a lowercase value should be normalized before testing, not accepted as-is.
  • The reserved 0 in position five is a current RBI convention, not a value this pattern can guarantee will hold if the scheme ever changes.

Related in Patterns