State registration (IE)

State tax registration numbers, validated per state.

  • Parity matrix

Validate

Validates an inscrição estadual (state registration) for a given state. It uses the format and check-digit rule that the state publishes (SINTEGRA).

  • params.value is the registration, a string. Any other type, or a missing value, returns false. params.stateCode is the two-letter state code, case-insensitive, and surrounding whitespace is ignored (until 2.4.0 whitespace made the state unknown and the result false). An unknown or missing state returns false.
  • Punctuation and spaces in the registration are ignored. Letters are dropped before the check for every state but SP, where only P is accepted.
  • JavaScript also keeps the 2.3.0 form isValidIe(stateCode, ie), deprecated. It answers like the object form. Other languages take only the parameters object.
  • Several states have special cases: GO, PA, MS, MT, SP, TO, DF, PE, AL, AM, RR, MG and RO. These are extra prefixes or formats, or readings where the SINTEGRA page is silent or disagrees with the state's own acts. When official sources disagree, the library keeps its behavior and documents what it rests on.
  • AL: the third digit is the tipo de empresa and must be 0, 3, 5, 7 or 8, the five the SINTEGRA page lists. 2.4.0 accepted any third digit.
  • DF: 13 digits with prefix 07 or 08. DF moved to 08 when the 07 numbers ran out. No SEFAZ-DF act announces it; the prefix rests on the CF/DF validator of the Receita DF portal and on software notes. 2.4.0 accepted only 07.
  • GO: 9 digits with prefix 10, 11, 15 or 20 to 29. IN 946/09-GSF (as worded by IN 1.535/22-GSE) gives 10 and 20 for companies and 11 for individuals, and the Secretaria da Economia has issued 20 to new companies since 13/01/2023. The SINTEGRA page (2022) gives 20 to 29, and only the 2012 roteiro de crítica gives 15. The check digit follows the 2012 roteiro, including its special range 10103105 to 10119997 and the dual-digit registration 11094402, so 101031050 is rejected. 2.4.0 rejected the prefixes 20 to 29. No norm names 15 or 21 to 29, so the official sources disagree and all of the prefixes are accepted. The check digit rule of the SINTEGRA page (2022) always reads a remainder of 0 or 1 as 0; this library follows the roteiro, as 2.4.0 did.
  • MT: 9 digits, the form Portaria SEFAZ-MT 59/2025 art. 8º § 1º prescribes, or the 11 digits the SINTEGRA page prints. The 9-digit form is checked as the 11-digit one padded with two zeros. 2.4.0 accepted only 11 digits.
  • PA: 9 digits with prefix 15 or 75 to 79, the six the SINTEGRA page lists. SEFA-PA announced only 75 (08/10/2024); 76 to 79 rest on the page. This is the 2.4.0 behavior.
  • PE: the 9-digit eFisco number or the old 14-digit CACEPE number (13 digits and 1 check digit, weights 5, 4, 3, 2, 1, 9 down to 2, a difference above 9 minus 10). Portaria SF 087/2007 converted the old numbers but set no date after which they are void. 2.4.0 accepted only 9 digits.
  • SP: a produtor rural registration is P then 0MMMSSSSD000, so the character after P must be 0 (P0 + 11 digits). The P may be lower case. Letters other than P are rejected. 2.4.0 accepted any digit after the P.
  • MS: prefixes 28 and 50, the two the SINTEGRA page (2024) gives. A SEFAZ-MS communiqué says new companies start with 50, while the only norm, Resolução/SEF 1.344/1999, gives 28 alone. The check digit rule is the same for both.
  • RR: the prefix 24 is required. The SINTEGRA page never writes it: it is read from the page's ten valid examples, which all start with 24.
  • TO: the 9-digit form in force (Portaria SEFAZ-TO 676/2002, art. 3º; RICMS-TO, art. 90), with no prefix check, or the old 11-digit form the SINTEGRA page documents, whose tipo digits (3rd and 4th, left out of the check digit sum) must be 01, 02, 03 or 99.
  • AM: the SINTEGRA page gives a rule with two branches and leaves "Resto" undefined. The library reads it as the sum modulo 11 and gives 0 to a sum of 0 or 1, which is the shared modulus 11 rule (weights 9 down to 2, a remainder of 0 or 1 giving 0).
  • RO: the 14-digit form (13 digits and the check digit) the SINTEGRA page gives for registrations since 01/08/2000. The 9-digit form it still prints for the earlier formula (101.62521-3) is rejected: those numbers were converted to 0000000062521-3.
  • MG: a first check digit of 10, from a sum that is already a multiple of ten, is read as 0.
  • An all-zero registration is accepted wherever the published formula gives a check digit of 0 for it: AM, CE, ES, MG, PB, PE (9 digits), PI, PR, RJ, RS, SC, SE and SP, plus BA with 8 or 9 digits, MT with 9 or 11 digits and TO with 9 digits. Unlike cpf.isValid and cnpj.isValid, the IE does not reject repeated digits.
ParameterTypeRequired
paramsIsValidIeParamsyes
params.valuestringyes
params.stateCodeStateCodeyes
returnsboolean

Check if an inscrição estadual (state registration) is valid for a state. Deprecated: the positional form isValidIe(stateCode, ie) still works but is deprecated; use the object form isValidIe({ value, stateCode }).

  • Takes a single object (IsValidIeParams): value is the registration and stateCode the state it belongs to (a StateCode, case-insensitive, with surrounding whitespace ignored).
  • Some states have special cases, a prefix or format the SINTEGRA page does not print or a deliberate deviation from it (details and sources in the JSDoc in src/is-valid-ie):
    • GO: the prefixes 10, 11, 15 and 20 to 29, the union of sources that disagree: the norm (IN nº 946/09-GSF, art. 39, I, as worded by IN nº 1.535/22-GSE) gives 10, 20 and 11, the SINTEGRA page 10, 11 and 20 to 29, the 2012 roteiro de crítica 10, 11 and 15. The check digit follows the roteiro, as in 2.4.0: a remainder of 1 gives 1 in the range 10103105 to 10119997, and 11094402 takes either digit, special cases the SINTEGRA page (2022) does not have.
    • MT: 11 digits, or the 9 digits Portaria SEFAZ-MT nº 59/2025 (art. 8º, § 1º) prescribes, read as the 11 digit form padded with two zeros (no official text gives the check digit rule of the 9 digit form).
    • PA: the prefixes 15 and 75 to 79 the SINTEGRA page lists (SEFA-PA has issued 75 since 07/10/2024). MS: the prefixes 28 and 50 the SINTEGRA page gives (50 is also in a SEFAZ-MS e-CCE communiqué; the only norm, Resolução/SEF nº 1.344/1999, gives 28 alone).
    • DF: the 13 digit AC rule under the prefixes 07 and 08. The SINTEGRA page does not call 07 fixed; SEFAZ-DF's rule sheet calls it a "campo fixo". DF moved to 08 when the numbers starting with 07 ran out.
    • RR: the prefix 24, which the SINTEGRA page does not write as a rule: it is read from the page's ten examples.
    • SP: the produtor rural form P0MMMSSSSD000, the zero after the P included; the P may be written in lower case.
    • TO: the 9 digits in force (Portaria SEFAZ-TO nº 676/2002, art. 3º; RICMS-TO, Decreto nº 2.912/2006, art. 90), or the old 11 digits the SINTEGRA page documents, with the tipo digits 01, 02, 03 or 99.
    • AM: the page's check digit rule has two branches and leaves "Resto" undefined; the library reads it as the sum modulo 11 and gives 0 to a sum of 0 or 1, the shared modulus 11 rule.
    • MG: a first check digit of 10, from a sum that is already a multiple of ten, is read as 0.
    • PE: the 9 digit eFisco form and the old 14 digit CACEPE form, both on the SINTEGRA page (Portaria SF nº 087/2007 converted the old numbers but set no date after which they are void).
    • RO: the 14 digit form the SINTEGRA page gives for registrations since 01/08/2000. The 9 digit form it still prints for the earlier formula (101.62521-3) is rejected: those numbers were converted to 13 digits plus the check digit (0000000062521-3).
    • AL: the third digit, the tipo de empresa, must be 0, 3, 5, 7 or 8, the values the SINTEGRA page lists.
  • An all-zero registration is accepted wherever the published formula yields a check digit of 0 for it: AM, CE, ES, MG, PB, PE (9 digits), PI, PR, RJ, RS, SC, SE and SP, plus BA with 8 or 9 digits, MT with 9 or 11 digits and TO with 9 digits.
import { isValidIe } from '@brazilian-utils/brazilian-utils';

isValidIe({ value: '110042490114', stateCode: 'SP' }); // true
isValidIe({ value: 'P011004243002', stateCode: 'SP' }); // true (produtor rural)
isValidIe({ value: '0187634580933', stateCode: 'AC' }); // false
isValidIe({ value: '109161793', stateCode: 'go' }); // true (case-insensitive)
isValidIe({ value: '109161793', stateCode: ' GO ' }); // true (surrounding whitespace ignored)
isValidIe({ value: '200000004', stateCode: 'GO' }); // true (prefix 20)
isValidIe({ value: '130000019', stateCode: 'MT' }); // true (9 digits)

Source: SINTEGRA state pages, the Goiás roteiro de crítica and IN nº 946/09-GSF.

Code: brazilian-utils/javascript
Try it with JavaScript isValidIe
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 (264) and the result in each library ie.isValid

Guides

Official sources

See also CNPJ

Last updated on

On this page