ANNOTATED SAMPLE

CNAB240 — a payment file header and one Segmento A

Two of the 240-character lines a Brazilian company sends its bank: the file header, which says who the file is from and which layout version it is written to, and one Segmento A, which is one payment. Read character 8 first — 0 marks the header and 3 marks a detail record — then character 14, which says this detail record is a Segmento A. Those fourteen characters are the only part of the line that describes itself. Everything after them is found by counting, which is why the amount at 120–134 reads 000000000123456 and means R$ 1,234.56: the last two digits are centavos and the decimal point is never written.

SYNTHETIC / TRAINING ONLY. Illustrative, non-production example. Values are fictional and the message is not validated for any specific network, scheme, or implementation guide.

FULL CNAB240 Seg A REFERENCE →

Sources for this sample — 3 sources
  1. Official requirement

    Layout Padrão CNAB240 ↗ — FEBRABAN (Federação Brasileira de Bancos) · Layout Padrão CNAB240 — the layout FEBRABAN publishes for these files and the record types it defines; no position on this page is quoted from it

    Defines the 240-position record layout Brazilian banks exchange with their corporate customers for payments and collections: the record types, the batch structure, and the character position and picture clause of every field. · Checked 2026-08-04

    Published openly as a versioned PDF, and this entry does not claim to have opened it: febraban.org.br could not be fetched, so verification relied on two independent web-search excerpts.

    The version and date carried here — V 10 11, 21/08/2023 — are read off the published file name rather than from the document itself. And search results list a second file carrying the same version string under a different date, so treat both as the publisher's naming and not as the layout's own declaration.

    FEBRABAN revises the layout, and a revision moves field positions, so the version in force between a bank and its customer is what governs. Individual banks publish their own manuals derived from it and are free to use the reserved areas, which is why two banks' CNAB240 files can differ while both conform.

  2. Market practice

    CNAB Layouts — FEBRABAN file layouts transcribed to YAML ↗ — Glauber Portella (open source) · config/febraban/cnab240/pagamentos.yml — the tipo_registro field at position 8 with its seven-value domain, and the Segmento A position ranges

    A machine-readable transcription of the FEBRABAN CNAB240 layouts, giving each field's position range and picture clause. Used here to check the position table published on this site against something a reader can open and check for themselves. · Checked 2026-08-04

    A community transcription, not the standard: the payments (pagamentos) layout it carries declares itself version 09.1, which is older than the version FEBRABAN currently publishes.

    It is cited for the shape of the record and for positions that are stable across versions: the 8-character common prefix of bank code, batch number and record type, and the segment letter. It is never cited as the authority on a current field position.

    Positions 9 to 13 are not part of that prefix: on a detail record they carry the record's sequence number within the batch, and on a file header the same characters are a FEBRABAN-reserved filler. Read FEBRABAN's own PDF, at the version your counterparty sends, before building.

  3. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    What this simplifies: Fictional company, beneficiary, branch and account numbers and references, and a two-line extract rather than a whole file. A real file carries a batch header, a batch trailer and a file trailer around these, and their control totals are what a bank checks first. Both three-digit bank codes are constructed rather than borrowed — 990 for the bank the file is addressed to and 975 for the beneficiary's bank — because Compe assigns nothing in the 9xx range, so neither code names a real Brazilian institution. The branch and account check digits are made up too: each bank computes those with its own algorithm, and nothing here reproduces one. The layout version stamped at 164-166 is 091, meaning version 09.1, which is the version of the position table these offsets were checked against; a parser built for a different version would read valid-looking values from the wrong offsets. Not validated against any bank.

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.