Skip to main content

National NFS-e Access Key Generator

Generate and format valid 50-digit Brazilian National Service Invoice (NFS-e) access keys according to CGNFS-e and RFB standards.

Waiting for generation...

About the Brazilian National NFS-e Access Key

The National NFS-e Access Key is a 50-digit unique identifier established by the NFS-e Steering Committee (CGNFS-e) to unify electronic service tax invoicing across Brazilian municipalities.

It encapsulates the issuing municipality IBGE code, emission environment, federal registration type (CPF or CNPJ), document sequence number, year and month of issuance, security code, and Modulo 11 check digit.

Anatomy & Structure of National NFS-e Key (50 Digits)

Official structure standardized by the National NFS-e Taxpayer Manual (MOC):

PositionFieldLengthMeaning & SpecificationExample
01 to 07cMun7 digitsIBGE code of the municipality where ISS tax applies3550308 (SP)
08tpAmb1 digitIssuing environment (1=Municipal System, 2=National)2
09tpInsc1 digitIssuer ID type (1=CPF, 2=CNPJ)2
10 to 23Insc14 charactersFederal Tax ID (CPF with 3 leading zeros or CNPJ)00000000000191
24 to 36nNFSe13 digitsNFS-e sequential invoice number in National Environment0000000000001
37 to 40AAMM4 digitsYear and month of document issuance2609
41 to 49cNFSe9 digitsRandom numerical security code123456789
50cDV1 digitCheck digit calculated via Modulo 110

Check Digit Calculation Algorithm (Modulo 11)

Official calculation performed by tax authorities on the first 49 positions:

S = Σ(d_i * weight_i) | DV = rem < 2 ? 0 : 11 - rem
  1. 1. Iterate from position 49 down to 1 (from right to left).
  2. 2. Convert characters to numeric values (ASCII - 48).
  3. 3. Multiply each value by cyclic weights [2, 3, 4, 5, 6, 7, 8, 9, 2, 3...].
  4. 4. Sum all products and calculate the remainder modulo 11 (Sum % 11).
  5. 5. If remainder is 0 or 1, check digit is 0; otherwise it is 11 minus remainder.

Frequently Asked Questions & Technical Specifications