7 releases (3 stable)

1.0.2 Oct 5, 2022
1.0.1 Feb 2, 2022
1.0.0 Jan 30, 2022
0.3.2 Sep 24, 2019
0.2.0 Nov 13, 2018

#275 in Finance

MIT license

1.5K SLoC


GitHub Actions Workflow Docs Status codecov Crates.io license

A strict MT940 bank statement parser in Rust.


  • Parse MT940 bank statements.
  • Strict and well-researched.
  • Super simple API and nice Rusty structs.
  • Small commandline utility that allows for quick and easy conversion of MT940 statements to JSON.
  • Well tested with many automated tests to find weird corner cases.
  • Pretty fast.

Planned features

  • MT941 support
  • MT942 support

Library usage example

use mt940::parse_mt940;

fn main() {
    let input = "\
        Beneficiary name\r\n\
        Something else\r\n\
        :61:0910010930DR62,60NCHGcustomer id//bank id\r\n\
        :86:Fees according to advice\r\n\

    let input_parsed = parse_mt940(input).unwrap();
    assert_eq!(input_parsed[0].transaction_ref_no, "3996-11-11111111");

CLI usage example

cargo run --bin sta2json tests/data/mt940/full/danskebank/MT940_DK_Example.sta


Documentation is here.


Time to parse the provided MT940_FI_Example.sta:

mt940-rs (this crate) mt940-js (NodeJS) mt-940 (Python)
Time for file 0.054ms 0.08ms 1.15ms
Performance 600000 lines per sec 400000 lines per sec 28000 lines per sec


Some banks bank use weird derivates of MT940 that do not strictly follow the specification. In that case you should try to do some pre-processing either by yourself or using one of the provided sanitizers.

Resources and acknowledgements

Referencing proper docs is important because because banks seem to be somewhat lenient about their strictness in implementing MT940. Below I assembled a list of resources that I reference.

Other projects


Amazing interactive docs.


They provide tons of good docs.

Bank Austria

Deutsche Bank


Westpac Banking

Societe Generale Srbija

Bank Millennium

DZ Bank


ING Bank


Rabo Bank

SEPA for Corporates


~227K SLoC