Guides / MT940
MT940 explained: the :61: and :86: lines
MT940 is the SWIFT text format for a bank statement. Each transaction is a :61: line (dates, a debit or credit mark, the amount, a type and references) followed by an :86: line (free-text details, laid out differently by each bank). Milyo's free matcher reads both in your browser and turns each :61: and its :86: into one row.
A small statement
This statement is made up. It has one credit from Stripe and one reversed debit.
:20:940S261231
:25:NL91ABNA0417164300
:28C:1/1
:60F:C261231EUR500,00
:61:2612310102C1799,55NTRFEREF//ABCDE99999
:86:/EREF/po_1Q8xLm/REMI/USTD//Stripe payout po_1Q8xLm/NAME/STRIPE PA
YMENTS UK LTD/
:61:261231RD20,00NMSCNONREF
:86:Reversal card fee
:62F:C261231EUR2319,55
Every line starts with a tag between colons. A line that does not start with a colon continues the line before it. That is why the Stripe name above runs onto a second line.
The tags Milyo reads
| Tag | What it holds | What Milyo does with it |
|---|---|---|
:20: | Statement reference. Starts a statement. | Starts a new statement. A file with no :20: is rejected. |
:25: | Account, often an IBAN. | The account column. |
:28C: | Statement and sequence number. | The statement column. |
:60F:, :60M: | Opening balance: a C or D mark, a date, a currency, an amount. | Takes the currency from it. Every line below uses that currency. The amount is not read. |
:61: | One statement line: one transaction. | One row. |
:86: | Details for the :61: just above it. | Fills that row's references, text and name. |
:62F:, :62M: | Closing balance. | Ends the statement's lines. The amount is not read. |
Other tags, such as :64: and :65:, are skipped. An :86: that comes after the closing balance is a note about the whole statement, so Milyo ignores it. Milyo does not check that the lines add up to the closing balance.
The :61: line, part by part
Take the first line from the statement above: :61:2612310102C1799,55NTRFEREF//ABCDE99999
| Part | Example | Meaning |
|---|---|---|
| Value date | 261231 | YYMMDD: 31 December 2026. Milyo reads the year as 20yy. |
| Entry date | 0102 | MMDD, optional. The day the bank booked it: 2 January. It has no year, so Milyo takes the value date's year, and moves it to the next year when a December value date has a January entry date. Here, 2027-01-02. The reverse (January value, December entry) moves it back a year. With no entry date, the value date is used. |
| Mark | C | C, D, RC or RD. See below. One extra letter after it, the funds code, is allowed and ignored. |
| Amount | 1799,55 | A comma for the decimal mark. 980, means 980 with no decimals. Milyo writes it with a dot. |
| Type | NTRF | N, S or F, then a three-letter code: TRF for a transfer, MSC for miscellaneous, CHG for charges. |
| Customer reference | EREF | Up to 16 characters. NONREF means the bank had none. |
| Bank reference | ABCDE99999 | After //, optional. |
| Supplementary | An optional second line of up to 34 characters. Milyo keeps it in the supplementary column. |
Sign: C, D, RC and RD
The amount in a :61: line has no sign. The mark gives it one.
| Mark | Meaning | Milyo's amount |
|---|---|---|
C | Credit: money in. | Positive |
D | Debit: money out. | Negative |
RC | Reversal of a credit: a credit that is taken back. | Negative |
RD | Reversal of a debit: a debit that is given back. | Positive |
In the small statement, RD20,00 becomes 20.00: money back. The credit_debit column keeps the mark as written, so you can still tell a reversal from a plain credit.
The :86: line has no single layout
SWIFT says :86: holds free text. Each bank fills it in its own way. Milyo reads the two layouts we have test files for, and falls back to the text itself.
German banks: ?nn subfields
The text starts with a posting-text code, then subfields marked ?00 to ?99. Here is an example, with the line wrapped as banks do:
:86:177?00SEPA-UEBERWEISUNG?20EREF+INV-2291?21SVWZ+Rechnung 2291 Ok
?22tober?32ACME Hosting Gm?33bH
| Subfields | Holds | Milyo's column |
|---|---|---|
?20 to ?29, ?60 to ?63 | The payment text, cut into 27-character pieces. | Joined with no spaces, because the cuts fall inside words ("Ok" + "tober"). Then split on keywords. |
EREF+ inside the text | The end-to-end id. | end_to_end_id: INV-2291 |
SVWZ+ inside the text | The payment text for the payer. | remittance: Rechnung 2291 Oktober. With no SVWZ+, the whole text. |
?32, ?33 | The other party's name. | counterparty: ACME Hosting GmbH |
The other keywords (KREF+, MREF+, CRED+, ABWA+, ABWE+, DEBT+) mark where a value ends, but get no column of their own. Neither do the posting text in ?00 or the bank code and account in ?30 and ?31. All of it stays, unparsed, in the details column.
Dutch banks: slash codes
The text is a run of /CODE/value pairs, as in the small statement:
/EREF/po_1Q8xLm/REMI/USTD//Stripe payout po_1Q8xLm/NAME/STRIPE PAYMENTS UK LTD/
/EREF/becomesend_to_end_id:po_1Q8xLm./REMI/becomesremittance:Stripe payout po_1Q8xLm. Milyo drops theUSTD//tag that marks unstructured text./NAME/becomescounterparty:STRIPE PAYMENTS UK LTD. In the file the name wraps mid-word; Milyo joins the lines with no space.
Only a fixed list of codes splits the text: EREF, CREF, PREF, IREF, REMI, NAME, BIC, IBAN, CSID, MARF, TRTP, ULTC, ULTD, TRCD, ORDP, BENM, CNTP, PURP, RTRN and ADDR. Only three of them get columns. A slash inside a value, as in Fee refund INV/2311, therefore stays whole.
Anything else
If the :86: text is neither layout, Milyo puts all of it in remittance and details.
What the file may look like
- With or without the SWIFT envelope. The
{1:}{2:}{4: … -}wrapper is optional. Milyo reads the text inside block 4. - Several statements in one file. Each
:20:starts a new one. All their lines are read, in order. - Encoding. UTF-8 when the file is valid UTF-8, otherwise Latin-1. A Latin-1 file that says Müller reads as Müller, not as garbled text.
- File names. The matcher takes
.sta,.940and.mt940. A.txtfile is read as MT940 when it starts with a SWIFT block or a:20:-style tag. - Bad files stop with a line number. A
:61:before any:60F:is an error. So is a:61:that does not fit the layout above, and a file with no statement.
The columns Milyo produces
One row per :61:: statement, account, value_date, booking_date, amount, currency, credit_debit, transaction_type, customer_ref, bank_ref, end_to_end_id, remittance, counterparty, supplementary and details. Dates are YYYY-MM-DD. Amounts are signed decimals with a dot.
Read it in the free matcher
- Open try.milyo.app and drop the statement on File A or File B. Nothing is uploaded: the page's security policy only lets it talk to its own address.
- Go to Map columns. You see the entry count and the first 20 entries, with the columns above.
- Milyo suggests the mapping: Transaction ID from
bank_ref, Date frombooking_date, Reference fromremittance, plus amount, currency and counterparty. MT940 holds booked entries only, so there is no status filter.
To match on the end-to-end id, for example a Stripe payout id from /EREF/, set Reference to end_to_end_id in the mapping step. The key pass compares whole values, so the id must be the whole value.
Use the free converter
To get the whole statement as a CSV, open try.milyo.app/mt940-to-csv, drop the file and choose "Download CSV". You get one row per :61: line with the columns above, in your browser, with nothing uploaded. The matcher can also download the statement: drop it, then choose "Download as CSV".
Have a statement and a ledger to compare? Load both. No account. Your files stay in your browser.
Open the free matcher