
Brazil NF-e XML Technical Requirements: Layout 4.00 Compliance Guide
Tax & Compliance Series
This guide is part of a comprehensive series. Explore all 202 topics:
What Is the NF-e XML Layout 4.00 Structure?
The NF-e XML follows a hierarchical structure defined by the Receita Federal:
The NF-e XML follows a hierarchical structure defined by the Receita Federal:
infNFe — Core Invoice Data
- ide: Invoice identification — number, series, type (0=input, 1=output), CFOP, municipality codes
- emit: Issuer data — CNPJ, state registration (IE), tax regime code (1=Simples Nacional, 2=excess, 3=normal)
- dest: Recipient data — CNPJ/CPF, state registration, address with IBGE municipality code
- det: Line items — product codes (NCM, CEST), descriptions, quantities, prices, tax calculations
- total: Invoice totals — tax summaries for ICMS, IPI, PIS, COFINS
- transp: Transport data — carrier CNPJ, vehicle plates, freight type
- pag: Payment details — method code, amounts, card data for electronic payments
What Are CFOP Codes and Why Do They Matter?
CFOP (Código Fiscal de Operações e Prestações) codes define the tax nature of each transaction.
CFOP (Código Fiscal de Operações e Prestações) codes define the tax nature of each transaction. Using the wrong CFOP is the #1 cause of NF-e rejections:
| CFOP Range | Operation Type | Example |
|---|---|---|
| 5.xxx | Intrastate sales (within state) | 5.102 — Sale of purchased goods |
| 6.xxx | Interstate sales (between states) | 6.102 — Interstate sale of purchased goods |
| 7.xxx | Export sales | 7.101 — Export sale of own production |
| 1.xxx/2.xxx/3.xxx | Purchase operations | 1.102 — Intrastate purchase |
Common CFOP Errors
- Using a 5.xxx code for an interstate transaction (must be 6.xxx)
- Mismatching CFOP with the CST (Tax Situation Code) — e.g., exempt CFOP with taxed CST
- Using a return CFOP (5.202) without referencing the original NF-e
How Does ICMS Tax Calculation Work in NF-e?
ICMS (Imposto sobre Circulação de Mercadorias e Serviços) is the most complex tax in the NF-e:
ICMS (Imposto sobre Circulação de Mercadorias e Serviços) is the most complex tax in the NF-e:
- Interstate rates: 4% (imported goods), 7% (South/Southeast to North/Northeast), 12% (all other interstate)
- Intrastate rates: 17–22% depending on state and product
- ICMS-ST (Substituição Tributária): Prepaid tax collected by the first seller in the chain — requires MVA (Margem de Valor Agregado) calculation
- DIFAL: Interstate rate differential collected for B2C sales to other states
What Are Common SEFAZ Rejection Codes?
Invoicemonk automates Brazil's NF-e compliance with built-in CFOP code selection, ICMS calculation engine, NCM validation, and real-time SEFAZ submission — eliminating common rejection errors.
| Code | Reason | Fix |
|---|---|---|
| 302 | IE (State Registration) irregular | Verify recipient's state registration status |
| 539 | Duplicate NF-e number | Increment the NF-e number — each number+series is unique |
| 598 | NCM code invalid | Use valid NCM (Nomenclatura Comum do Mercosul) product code |
| 694 | CFOP inconsistent with operation | Match CFOP to state codes (5xxx/6xxx/7xxx) |
| 778 | ICMS calculation error | Verify base × rate matches the stated tax amount |
Invoicemonk automates Brazil's NF-e compliance with built-in CFOP code selection, ICMS calculation engine, NCM validation, and real-time SEFAZ submission — eliminating common rejection errors.
More in this series (202 articles)
From this series
Stay audit-ready and compliant with tax regulations across different regions.
Related Topics
Digital Marketing, SEO Specialist, Content Creator & Product Professional
Olayinka is a digital marketer, content creator, growth and SEO specialist with 10+ years helping businesses in Nigeria, the UK, the US, Australia, and Dubai achieve their goals online.




