IBAN

Brazilian IBANs (International Bank Account Number, country code BR): validation, formatting, parsing and decoding.

  • Parity matrix

Validate

Validates a Brazilian IBAN. Any other country is invalid.

  • Layout, 29 characters: BR, 2 check digits (ISO 7064 MOD 97-10), 8-character ISPB (digits or letters), 5-digit branch, 10-digit account, 1-letter account type (usually C or P), 1 owner indicator (1 to 9, then A to Z).
  • Accepts the compact form or groups of 4 split by whitespace, ., - or /, in any case, with optional whitespace around the value. The separator is optional at each group boundary, so BR15 000000000000 1093 2840 814P 2 is also valid. The separators are the interchangeable mask characters of the CPF and CNPJ, alone or in a run (ISO 13616 prints one space), so BR1500000000000010932840814P-2 and BR15 0000 0000 0000 1093 2840 814P 2 are the same IBAN. Until 2.4.0 a run of separators between two groups made the IBAN invalid.
  • A separator away from a group boundary, or any character outside letters, digits and those separators, makes the IBAN invalid (BR15 000 00000 0000 1093 2840 814P 2). The character is not stripped. A value that is not a string is invalid.
  • The layout is set by Resolução BCB 585/2026, art. 2º, which revoked Circular BCB 3.625/2013 and kept its layout. Art. 2º, III, makes the ISPB "oito caracteres alfanuméricos", so a letter in the ISPB is accepted, in any case. 2.4.0 accepted only digits there. Every other digit position still rejects a letter.
  • The account type follows the ISO 13616 registry pattern (a letter). Art. 2º, VI, calls it "um caractere alfanumérico"; the registry form is kept, so a digit there is rejected.
ParameterTypeRequired
valuestringyes
returnsboolean

Check if a Brazilian IBAN (International Bank Account Number) is valid. Only Brazilian IBANs (country code BR) are recognized; any other country returns false.

  • Layout, 29 characters (Resolução BCB 585/2026, art. 2º, which revoked Circular BCB 3.625/2013 and kept its layout): BR, 2 check digits (ISO 7064 MOD 97-10), 8 character ISPB, 5 digit branch, 10 digit account, 1 letter account type, 1 owner indicator.
  • The ISPB may hold letters: the Resolução makes it "oito caracteres alfanuméricos", where the Circular said "numéricos". Up to 2.4.0 only digits were accepted.
  • Account type: any letter, usually C or P. Owner: 1 to 9, then A to Z.
  • Accepts the compact form or groups of 4 split by one whitespace, ., - or /, in any case.
import { isValidIban } from '@brazilian-utils/brazilian-utils';

isValidIban('BR1500000000000010932840814P2'); // true
isValidIban('BR15 0000 0000 0000 1093 2840 814P 2'); // true (grouping spaces)
isValidIban('BR15-0000-0000-0000-1093-2840-814P-2'); // true (any of the mask characters)
isValidIban('BR1012AB34CD000010932840814P2'); // true (alphanumeric ISPB)
isValidIban('BR1500000000000010932840814P3'); // false (bad check digits)
isValidIban('BR15 000 00000 0000 1093 2840 814P 2'); // false (a separator inside a group)
isValidIban('DE89370400440532013000'); // false (non Brazilian IBAN)

Source: Diretrizes de Implementação do IBAN no Brasil, Resolução BCB nº 585/2026, which revoked Circular BCB nº 3.625/2013, ISO 13616-1:2020.

Code: brazilian-utils/javascript
Try it with JavaScript isValidIban
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (38) and the result in each library iban.isValid

Format

Formats an IBAN in the ISO 13616 print grouping: blocks of 4 characters separated by spaces, upper-cased. It does not validate the IBAN (use iban.isValid).

Statements and bank forms show the IBAN in this form.

  • The function reads only letters and digits. The result is capped at the 29 characters of a Brazilian IBAN.
  • Every other character (a hyphen, a dot, extra whitespace) is dropped, so BR15 0000-0000.0000/1093 2840 814P-2 gives the same result as the compact form. A value that is not a string gives an empty string.
  • A partial value is grouped as far as it goes (BR15 gives BR15), so the function works as an input mask. The check digits and the layout are not checked, and an IBAN of another country is grouped the same way.
ParameterTypeRequired
valuestringyes
returnsstring

Format an IBAN in the ISO 13616 print grouping: blocks of 4 characters, the presentation used on statements and bank forms. Does not validate; use isValidIban for that.

  • Caps the result at 29 characters, the length of a Brazilian IBAN.
import { formatIban } from '@brazilian-utils/brazilian-utils';

formatIban('BR1500000000000010932840814P2'); // 'BR15 0000 0000 0000 1093 2840 814P 2'
formatIban('br1500000000000010932840814p2'); // 'BR15 0000 0000 0000 1093 2840 814P 2'
formatIban('BR15'); // 'BR15'
formatIban('BR15 0000-0000.0000/1093 2840 814P-2'); // 'BR15 0000 0000 0000 1093 2840 814P 2' (only letters and digits are read)

Source: Diretrizes de Implementação do IBAN no Brasil, Resolução BCB nº 585/2026, which revoked Circular BCB nº 3.625/2013, ISO 13616-1:2020.

Code: brazilian-utils/javascript
Try it with JavaScript formatIban
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (17) and the result in each library iban.format

Parse

Removes IBAN formatting and keeps letters and digits upper-cased, capped at 29 characters.

  • A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number gives an empty string (2.4.0 read the characters of any number, sign and decimal point dropped).
  • Every character that is not a letter or a digit is dropped and the letters are upper-cased.
  • A string is read as it is, so a value with no letter or digit, and a value that is neither a string nor a number, give an empty string.
ParameterTypeRequired
valuestring | numberyes
returnsstring

Remove IBAN formatting, keep the letters and digits, uppercase the result, and cap it to the 29 characters of a Brazilian IBAN.

import { parseIban } from '@brazilian-utils/brazilian-utils';

parseIban('BR15 0000 0000 0000 1093 2840 814P 2'); // 'BR1500000000000010932840814P2'
parseIban('br15-0000.0000/0000 1093 2840 814p-2'); // 'BR1500000000000010932840814P2'

Source: Diretrizes de Implementação do IBAN no Brasil, Resolução BCB nº 585/2026, which revoked Circular BCB nº 3.625/2013, ISO 13616-1:2020.

Code: brazilian-utils/javascript
Try it with JavaScript parseIban
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (9) and the result in each library iban.parse

Decode

Parses a Brazilian IBAN into its fields. Returns null whenever iban.isValid would return false.

  • Fields, all strings: countryCode (always BR), checkDigits (2 digits), bankIspb (8 characters, uppercase letters allowed since Resolução BCB 585/2026), branch (5 digits), account (10 digits), accountType (1 letter, usually C or P) and owner (1 to 9, then A to Z). Letters come upper-cased and the zero padding is kept.
  • The input rules are those of iban.isValid: the compact or grouped form, a run of mask characters between groups, any case. A value that is not a string gives null.
ParameterTypeRequired
valuestringyes
returnsIbanInfo | null

Parse a Brazilian IBAN into its fields. Returns an IbanInfo object, or null whenever isValidIban would return false.

  • Fields, all strings: countryCode, checkDigits, bankIspb, branch, account, accountType (usually C or P) and owner (1 to 9, then A to Z).
  • Same input rules as isValidIban.
import { getIbanInfo } from '@brazilian-utils/brazilian-utils';

getIbanInfo('BR1500000000000010932840814P2');
// {
//   countryCode: 'BR',
//   checkDigits: '15',
//   bankIspb: '00000000',
//   branch: '00001',
//   account: '0932840814',
//   accountType: 'P',
//   owner: '2'
// }

getIbanInfo('DE89370400440532013000'); // null (non Brazilian IBAN)
getIbanInfo('BR15 000 00000 0000 1093 2840 814P 2'); // null (a separator inside a group)

Source: Diretrizes de Implementação do IBAN no Brasil, Resolução BCB nº 585/2026, which revoked Circular BCB nº 3.625/2013, ISO 13616-1:2020.

Code: brazilian-utils/javascript
Try it with JavaScript getIbanInfo
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (22) and the result in each library iban.getInfo

Official sources

See also Banks

Last updated on

On this page