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):
| Position | Field | Length | Meaning & Specification | Example |
|---|---|---|---|---|
| 01 to 07 | cMun | 7 digits | IBGE code of the municipality where ISS tax applies | 3550308 (SP) |
| 08 | tpAmb | 1 digit | Issuing environment (1=Municipal System, 2=National) | 2 |
| 09 | tpInsc | 1 digit | Issuer ID type (1=CPF, 2=CNPJ) | 2 |
| 10 to 23 | Insc | 14 characters | Federal Tax ID (CPF with 3 leading zeros or CNPJ) | 00000000000191 |
| 24 to 36 | nNFSe | 13 digits | NFS-e sequential invoice number in National Environment | 0000000000001 |
| 37 to 40 | AAMM | 4 digits | Year and month of document issuance | 2609 |
| 41 to 49 | cNFSe | 9 digits | Random numerical security code | 123456789 |
| 50 | cDV | 1 digit | Check digit calculated via Modulo 11 | 0 |
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. Iterate from position 49 down to 1 (from right to left).
- 2. Convert characters to numeric values (ASCII - 48).
- 3. Multiply each value by cyclic weights [2, 3, 4, 5, 6, 7, 8, 9, 2, 3...].
- 4. Sum all products and calculate the remainder modulo 11 (Sum % 11).
- 5. If remainder is 0 or 1, check digit is 0; otherwise it is 11 minus remainder.