NF-e / NFS-e Key Reader
Decode the access key of NF-e, NFC-e, CT-e, MDF-e (44 positions) and National NFS-e (50 positions): state, date, CNPJ/CPF, model, series, number and check digit.
Fictitious examples: · · ·
How the access key is built
44 positions — NF-e, NFC-e, CT-e, MDF-e
| Position | Len. | Field |
|---|---|---|
| 1–2 | 2 | IBGE code of the issuer's state |
| 3–6 | 4 | Year and month of issue (YYMM) |
| 7–20 | 14 | Issuer's CNPJ (or CPF padded with “000” on the left). From July 2026 the CNPJ may be alphanumeric. |
| 21–22 | 2 | Model (55 NF-e, 65 NFC-e, 57 CT-e, 67 CT-e OS, 58 MDF-e…) |
| 23–25 | 3 | Series |
| 26–34 | 9 | Document number |
| 35 | 1 | Issue type (tpEmis) |
| 36–43 | 8 | Random numeric code |
| 44 | 1 | Check digit (modulo 11) |
In CF-e SAT (model 59), positions 23–43 hold the device serial number (9), the receipt number (6) and the numeric code (6).
50 positions — National NFS-e
| Position | Len. | Field |
|---|---|---|
| 1–7 | 7 | IBGE municipality code |
| 8 | 1 | Issuing environment (1 municipality, 2 National Sefin) |
| 9 | 1 | Federal registration type (1 CPF, 2 CNPJ) |
| 10–23 | 14 | Issuer's CNPJ or CPF |
| 24–36 | 13 | NFS-e number |
| 37–40 | 4 | Year and month of issue (YYMM) |
| 41–49 | 9 | Numeric code |
| 50 | 1 | Check digit |
Check digit
Each position, from right to left, is multiplied by weights 2 to 9 (restarting at 2), the results are summed and the remainder of division by 11 is computed. Remainder 0 or 1 → check digit 0; otherwise, check digit = 11 − remainder. With the alphanumeric CNPJ, each letter is worth its ASCII code minus 48 (A = 17, B = 18…).
This tool checks the key structure; it does not query SEFAZ or confirm whether the document was authorized or cancelled.