1001Ferramentas
๐ŸงพGenerators

NF-e Sequential Number Generator

Generate the NF-e sequential number (9 digits) followed by series (3 digits). Not the 44-digit access key.


  

NF-e number (nNF): sequencing, series and emission flow

The NF-e number (numero da nota fiscal, field nNF) is the human-readable sequential identifier assigned by the issuer to each electronic invoice. It is distinct from the 44-digit access key โ€” the number is short (up to 9 digits, range 1-999,999,999) and only unique within the combination of issuer CNPJ + document model + series. Two different issuers can have an invoice number "1234" simultaneously; the access key is what makes the whole record globally unique.

Each issuing CNPJ chooses its own numbering policy. Most enterprises start at 1 and increment forever; once a series approaches 999,999,999 the issuer migrates to a new series. Some accounting systems reset numbering yearly or per branch (filial) for operational clarity โ€” this is permitted as long as (CNPJ, mod, serie, nNF) never repeats.

Series and document models

The series (serie) is a 3-digit (0-999) partition of the numbering space. Conventions:

  • Series 0 โ€” traditional, used by companies with a single issuing point.
  • Series 1-99 โ€” normal operations, typically per branch or per business unit.
  • Series 900-999 โ€” reserved for offline contingency on NFC-e (tpEmis = 9). Numbers here are pre-allocated and used when the SEFAZ link is down.

Document models drive different fiscal flows:

  • 55 โ€” NF-e (general electronic invoice, B2B).
  • 65 โ€” NFC-e (consumer-facing).
  • 57 โ€” CT-e (transport).
  • 58 โ€” MDF-e (manifesto).
  • 67 โ€” CT-e OS (transport of other services).
  • 21/22 โ€” telecom and electricity invoices.

Emission flow and statuses

Issuing an NF-e involves: (1) the issuer assembles the XML with the next nNF in the chosen series, (2) signs with an ICP-Brasil A1 or A3 certificate, (3) submits to the appropriate SEFAZ-UF web service, (4) receives an authorization protocol or a rejection reason. Authorized documents can then be printed as DANFE with their access-key barcode.

Possible statuses for a given (model, series, number) tuple:

  • Authorized (cStat 100) โ€” XML approved; document valid for goods circulation.
  • Cancelled (cStat 101) โ€” cancellation event registered within 24h, before goods movement.
  • Inutilized (cStat 102) โ€” number range formally skipped so the sequence stays auditable.
  • Denied (cStat 110) โ€” refused due to fiscal irregularity of issuer or recipient.
  • EPEC / contingency โ€” issued offline under Evento Previo de Emissao em Contingencia rules.

Corrections, cancellation and inutilization

After authorization, minor mistakes (typos in product description, CFOP, additional information) can be fixed with a CC-e (Carta de Correcao Eletronica). The CC-e cannot change values, taxes, recipient CNPJ, issuer CNPJ, date of emission or quantities. For substantive errors, the issuer must cancel the NF-e within 24h (some operations allow up to 7 days for inutilization of the number). Once the legal window expires, the only legal path is a reverse operation (devolucao) by the recipient.

Validation and consultation

An issued NF-e cannot be queried by number alone on the public portal โ€” the access key is required for the SEFAZ NfeConsultaProtocolo service. The number is useful for internal reconciliation, ERP cross-reference, accounts receivable matching, and as the printed identifier on the DANFE. Libraries that drive emission include nfephp-org (PHP), NotaFiscalNet (Java) and several Node packages wrapping the SEFAZ SOAP services.

Frequently asked questions

Can I reuse a number that was rejected by SEFAZ? Yes. Only authorized numbers are locked. A rejected XML never consumed the number, so the same nNF can be resubmitted after fixing the issue.

Can I query an NF-e by number alone? No โ€” the public portal indexes by access key (44 digits). Internal ERPs index by (CNPJ, model, series, number), which uniquely identifies the document inside that issuer.

What happens at 999,999,999? The issuer must roll over to the next available series. Skipping is not allowed: any unused number must be formally inutilized via the Inutilizacao de Numeracao web service.

Is the generated number valid as a real NF-e? No. The number alone is not an invoice โ€” a real, enforceable document requires the full XML, the digital signature and the SEFAZ authorization protocol. This generator produces test sequences for development and integration scenarios.

Why do some companies use multiple series? To partition numbering by branch, by point of sale, by emission environment (homologacao vs producao) or by contingency mode. Each series has its own independent counter.

Related Tools