1001Ferramentas
🏦Validators

Bank Branch Validator

Validate Brazilian bank branch format (4 digits + optional DV).

Bank branch number (agência): 4 digits, sometimes a check digit

In a Brazilian account, the agência is the branch number — typically 4 digits, sometimes followed by a check digit after a hyphen (1234-5). Together with the 3-digit bank code and the account number, it forms the banco + agência + conta triple that uniquely locates an account for boletos, TED/DOC and direct debit. This tool checks the NNNN / NNNN-D format.

There is no national check-digit standard for the agência: whether a verifying digit exists, and how it's computed, is defined by each bank. Some banks publish a digit; others use the four digits alone. That's why a portable validator checks structure, not a universal checksum.

The account triple

  • Banco (3 digits, COMPE): which institution.
  • Agência (4 digits + optional DV): which branch.
  • Conta (varies + DV): the account itself.
  • All three are needed to route a legacy transfer; PIX bypasses them with a key.

Where it matters

  • Payment forms: agência is a required field for TED/DOC and boleto registration.
  • Payroll & supplier payments: batch files (CNAB) carry agência per beneficiary.
  • Reconciliation: matching deposits to the originating branch.
  • Mock data / testing: validating the NNNN-D mask before a transfer.

Common pitfalls

  • No universal check digit: don't apply one bank's DV rule to another's agência.
  • Keep leading zeros: 0001 is a real branch (often the head office); store as a string.
  • Hyphen optional: 1234-5 and 12345 can mean the same; normalise carefully.
  • Agência changes, account may not: branch mergers can reassign the agência number.

FAQ

Does the agência have a check digit? Sometimes — it's bank-specific. Many branches are just four digits; others append a DV.

Do I still need the agência for PIX? No — PIX routes by key (CPF, email, phone or random). Agência is for legacy TED/DOC and boletos.

Is 0001 valid? Yes — leading-zero branch numbers are common; treat the value as a 4-character string.

Related Tools