Build SPED Fiscal — EFD ICMS/IPI (pipe-delimited text)
Skill: Convert fiscal bookkeeping into the EFD ICMS/IPI text file
Region: Brazil (Brasil)
Category: SPED — Escrituração Fiscal Digital (EFD ICMS/IPI)
Does: Takes a period's fiscal bookkeeping (notas fiscais de entrada/saída, apuração de ICMS/IPI, inventory and production) and produces the SPED Fiscal — EFD ICMS/IPI pipe-delimited (|) text file, organised into blocos 0, C, D, E, G, H, K, 1, 9, validated and transmitted via the PVA EFD ICMS/IPI through ReceitaNet.
Standard: EFD ICMS/IPI — Ato COTEPE/ICMS (Guia Prático da EFD ICMS/IPI, leiaute vigente)
The EFD ICMS/IPI is a monthly state-and-federal obligation reporting the taxpayer's fiscal documents and the ICMS/IPI apuração. Each line is a registro delimited by pipes, starting and ending with
|. Records are hierarchical (a parent opens a block of children) and every block must carry its opening/closing/totaliser records. Confirm the active leiaute/Guia Prático and the obligated UF profile (perfil A/B/C) before use.
When this applies
- Establishments contribuintes do ICMS and/or IPI obligated to keep the EFD (most state regimes; periodicidade mensal).
- The file is generated, validated in the PVA (Programa Validador e Assinador), signed with certificado ICP-Brasil and transmitted via ReceitaNet; a recibo is returned.
- Companies in Simples Nacional generally do not file the EFD ICMS/IPI (they use PGDAS-D), unless required by the UF.
Input data required
| Group | Fields |
|---|---|
| Abertura / identificação | CNPJ, IE, razão social, UF, período (DT_INI/DT_FIN), COD_FIN, perfil, IND_ATIV |
| Cadastros (Bloco 0) | participantes (0150), itens/produtos (0200), unidades (0190), plano de contas |
| Documentos fiscais (Bloco C) | NF-e/NFC-e de entrada e saída (C100), itens e impostos (C170), ICMS por CST/CFOP/alíquota (C190) |
| Serviços de transporte/comunicação (Bloco D) | CT-e, energia/telecom (D100/D190) |
| Apuração (Bloco E) | apuração do ICMS (E110), ICMS-ST, apuração do IPI (E520) |
| Estoque/Produção (Bloco H/K) | inventário (H010), produção e consumo (K200/K230) |
| Encerramento | controle/totais (1010), totalizador (9900) e encerramento (9999) |
File structure (registros, pipe-delimited)
|0000| abertura — identificação do contribuinte e do período
|0001| abertura do Bloco 0
|0150| cadastro do participante (emit/dest)
|0190| unidade de medida |0200| identificação do item
|0990| encerramento do Bloco 0 (com QTD de linhas)
|C001| abertura do Bloco C (documentos fiscais — mercadorias)
|C100| documento fiscal (NF-e): CNPJ, CHV_NFE, valores, vICMS, vIPI
|C170| item do documento |C190| registro analítico por CST/CFOP/alíquota
|C990| encerramento do Bloco C
|D001|...|D990| Bloco D (CT-e, energia, comunicação)
|E001| abertura do Bloco E (apuração)
|E100|/|E110| período e apuração do ICMS (débitos, créditos, saldo)
|E500|/|E520| apuração do IPI
|E990| encerramento do Bloco E
|H001|...|H990| Bloco H (inventário)
|K001|...|K990| Bloco K (controle da produção e do estoque)
|1001|...|1990| Bloco 1 (obrigações acessórias / outras informações)
|9001| abertura do Bloco 9 |9900| totais por registro
|9990| encerramento do Bloco 9 |9999| encerramento do arquivo (QTD total de linhas)
Layout note: numeric fields use comma , as decimal separator; dates are ddmmaaaa; empty fields are left blank between pipes.
Calculation rules
- C190 is the analytical summary: group every item line (C170) by
CST_ICMS+CFOP+ALIQ_ICMSand sumVL_OPR,VL_BC_ICMS,VL_ICMS. The sum of C190 must reconcile with the document totals. - E110 (apuração do ICMS):
VL_SLD_APURADO=VL_TOT_DEBITOS+VL_AJ_DEBITOS−VL_TOT_CREDITOS−VL_AJ_CREDITOS−VL_ESTORNOS; a saldo devedor (DEB) is payable, saldo credor (CRE) carries forward. - Débitos come from saídas (C190 with CFOP de saída); créditos from entradas com direito a crédito.
- 9900 must list one line per distinct registro type with its occurrence count; 9999 carries the total line count of the file (including 0000 and 9999).
- IPI is apurado separately in the Bloco E (E520) for IPI contribuintes.
Worked example (period header + ICMS apuração, outline)
|0000|019|0|01052026|31052026|COMERCIO EXEMPLO LTDA|12345678000195|SP|111111111111|3550308|||A|1|
|0001|0|
|0150|F001|FORNECEDOR EXEMPLO LTDA|1058|22333444000155||SP|352440|RUA A|100||CENTRO|
|0190|UN|UNIDADE|
|0200|SKU-001|CADEIRA DE ESCRITORIO|||UN|00|94013000||0|18,00|||
|0990|5|
|C001|0|
|C100|1|0|F001|55|00|1|000000123|35250612345678000195550010000001231000001236|04052026|04052026|2000,00|0|||2000,00|9|0,00|2000,00|360,00|0,00|0,00|0,00|0,00|0,00|0,00|0,00|0,00|
|C170|1|SKU-001|CADEIRA DE ESCRITORIO|10,0000|UN|2000,00|0,00|0|000|5102|||2000,00|18,00|360,00|...|
|C190|000|5102|18,00|2000,00|2000,00|360,00|0,00|0,00|0,00|0,00|
|C990|4|
|E001|0|
|E100|01052026|31052026|
|E110|360,00|0,00|0,00|150,00|0,00|0,00|0,00|0,00|210,00|0,00|0,00|0,00|
|E990|4|
|9001|0|
|9900|0000|1|
|9900|C190|1|
|9900|9999|1|
|9990|...|
|9999|23|
The completed file is loaded into the PVA EFD ICMS/IPI, validated, signed (ICP-Brasil) and transmitted via ReceitaNet.
Validation checklist
-
|0000|carries the correct leiaute version, CNPJ/IE/UF,COD_FIN(0 remessa do original) andDT_INI/DT_FINof the período - Every bloco opened (
X001) and closed (X990) with the correct line count; blocos with no movement marked sem dados - All participantes (0150) and itens (0200) referenced in C/D records are cadastrados in Bloco 0
-
C100/C170carry the 44-digit chave de acesso and per-item ICMS/IPI; C190 analítico reconciles with the documents -
E110apuração: saldo = débitos + ajustes − créditos; saldo devedor/credor correct; IPI in E520 if applicable - Inventário (H010) and Bloco K reported when obligated; decimals use comma, dates
ddmmaaaa - 9900 counts per registro and 9999 total line count are exact; PVA validation passes; signed and transmitted via ReceitaNet
Last updated: 2026-06-04 — confirm the active layout version, field codes, and SEFAZ/Receita Federal requirements against the current specifications before use.