Brazil XML schema and technical format requirements
    E-Invoicing Compliance

    Brazil NF-e XML Technical Requirements: Layout 4.00 Compliance Guide

    Updated:
    10 min read

    Tax & Compliance Series

    This guide is part of a comprehensive series. Explore all 202 topics:

    Brazil's NF-e XML layout 4.00 is the current mandatory format for electronic goods invoices, enforced by all 27 state SEFAZs. The schema contains over 500 fields across fiscal, product, and transport data sections, with real-time validation rejecting invoices with incorrect CFOP codes, tax calculation mismatches, or invalid digital signatures. Understanding the technical requirements prevents the estimated 8–12% first-submission rejection rate.

    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 RangeOperation TypeExample
    5.xxxIntrastate sales (within state)5.102 — Sale of purchased goods
    6.xxxInterstate sales (between states)6.102 — Interstate sale of purchased goods
    7.xxxExport sales7.101 — Export sale of own production
    1.xxx/2.xxx/3.xxxPurchase operations1.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.

    CodeReasonFix
    302IE (State Registration) irregularVerify recipient's state registration status
    539Duplicate NF-e numberIncrement the NF-e number — each number+series is unique
    598NCM code invalidUse valid NCM (Nomenclatura Comum do Mercosul) product code
    694CFOP inconsistent with operationMatch CFOP to state codes (5xxx/6xxx/7xxx)
    778ICMS calculation errorVerify 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.

    Tags:
    brazil
    nf-e
    xml
    layout-4.00
    technical-guide
    OO
    Olayinka Olayokun

    Digital Marketing, SEO Specialist, Content Creator & Product Professional

    CIM Certified
    MBA in Digital Marketing and Business Transformation

    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.

    More from Tax & Compliance