To convert MT940 to CAMT.053 you have two options: upload the file to a free browser converter that needs no sign-up (MT940 to CAMT.053 online), or run it offline with the open-source Python package pip install mt940-camt053. MT940 is the older SWIFT text format for bank statements (tags such as :61: and :86:), and CAMT.053 is the ISO 20022 XML format that banks are moving to. Both routes read the MT940 file, check that opening balance plus transactions equals closing balance, and write CAMT.053 XML.
What is inside an MT940 file
An MT940 file is plain text. Each line starts with a tag. These are the tags the package reads (from its README and source):
| Tag | Meaning |
|---|---|
:20: |
Statement reference |
:25: |
Account identification |
:28C: |
Statement / sequence number |
:60F: / :60M:
|
Opening balance (final / intermediate) |
:61: |
One transaction: value date, booking date, debit or credit, amount, references |
:86: |
Free text for the transaction before it (purpose, counterparty, IBAN) |
:62F: / :62M:
|
Closing balance (final / intermediate) |
:64: |
Available balance |
The package also reads several statements in one file, the {1:}{2:}{4: -} SWIFT envelopes, and CRLF or LF line endings. In :86: it understands the German structured fields (?20 to ?29 purpose, ?30 BIC, ?31 IBAN, ?32 and ?33 name) and the /EREF/../NAME/../REMI/.. and EREF+ / SVWZ+ / MREF+ keyword styles.
Convert it in Python
The package needs only lxml (and openpyxl if you also want Excel output). This is a small MT940 statement with two transactions, saved as statement.sta:
:20:DE2611
:25:50010517/5413161111
:28C:00007/001
:60F:C261101EUR2500,00
:61:2611021102D99,90NMSCKREF1234//KB77
ABC12
:86:166?00Lastschrift?10931?20EREF+E2E-1234 SVWZ+Rechnung?21 5567 vom 01.11.2026 Kunde ?2212345 Danke?30COBADEFFXXX?31DE89370400440532013000?32Mueller + Soehne GmbH?33Abt. Einkauf?34000
:61:261105C1234,56NTRFNONREF
:86:051?00Gutschrift?20SVWZ+Zahlung Auftrag A-88?32Anna Schmidt
:62F:C261105EUR3634,66
-
And the script:
import mt940_camt053 as mc
stmts = mc.load("statement.sta")
for st in stmts:
state, diff = mc.balance_check(st)
print("account:", st["acct"], "| balance check:", state, diff)
for t in st["txs"]:
print(t["bdate"], t["amt"], t["name"], t["iban"], t["remit"])
xml = mc.to_camt053(stmts)
open("statement-camt053.xml", "wb").write(xml)
print(len(xml), "bytes of camt.053.001.08")
Real output of that script:
account: 50010517/5413161111 | balance check: ok 0.00
2026-11-02 -99.90 Mueller + Soehne GmbH Abt. Einkauf DE89370400440532013000 Rechnung 5567 vom 01.11.2026 Kunde 12345 Danke
2026-11-05 1234.56 Anna Schmidt Zahlung Auftrag A-88
3241 bytes of camt.053.001.08
The CAMT.053 file it wrote contains the opening and closing balances and one <Ntry> per transaction. The first debit looks like this (excerpt):
<Ntry>
<Amt Ccy="EUR">99.90</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<RvslInd>false</RvslInd>
<Sts><Cd>BOOK</Cd></Sts>
<BookgDt><Dt>2026-11-02</Dt></BookgDt>
<ValDt><Dt>2026-11-02</Dt></ValDt>
<AcctSvcrRef>KB77</AcctSvcrRef>
...
<RmtInf><Ustrd>Rechnung 5567 vom 01.11.2026 Kunde 12345 Danke</Ustrd></RmtInf>
</Ntry>
(I shortened the whitespace and left out the party and bank-code elements; the file itself is the full indented XML.) The default output is camt.053.001.08. For older systems pass version="001.02" to to_camt053.
One line on the command line
mt940-camt053 statement.sta -o cli-out.xml
Real output:
statement.sta -> cli-out.xml: 2 transactions in 1 statement(s), balance check ok
The same command works in the other direction: give it a CAMT.053 .xml and it writes MT940. Add --to csv or --to xlsx for a flat table.
Common problems
-
Balance check says "bad".
balance_checkadds the signed transaction amounts to the opening balance and compares the result with the closing balance. If the difference is not zero, a transaction is missing or was cut from the export. The amounts are still copied as they are, so you can see which statement is off. -
Debits and credits. In MT940 the sign comes from the letter
DorCin the:61:line, not from the amount. The package turns it into a signedDecimal(negative = money out) and writesDBITorCRDTin CAMT.053. - Encoding. Bank files are often not UTF-8. The reader accepts UTF-8 (with or without BOM), cp1252, latin-1 and UTF-16.
-
Information that is not in the file. MT940 holds less than CAMT.053. Structured party data exists in the result only if the bank wrote it into
:86:. Bank dialects of:86:differ, so check the first conversion against your own statement.
Limits
PDF or scanned statements are not read, because that needs OCR; the package raises a plain error for a PDF. Going from CAMT.053 back to MT940 cuts long texts at 6 lines of 65 characters, and the notes argument tells you when that happened.
Package: mt940-camt053 on PyPI (MIT licence, runs locally, no network calls).
Disclosure: I build the tool used in this post, and the article was written with AI assistance. If a code sample does not work for you, tell me in the comments and I will fix it.
Top comments (0)