MRZCodeParser 0.5.0

dotnet add package MRZCodeParser --version 0.5.0
                    
NuGet\Install-Package MRZCodeParser -Version 0.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MRZCodeParser" Version="0.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MRZCodeParser" Version="0.5.0" />
                    
Directory.Packages.props
<PackageReference Include="MRZCodeParser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MRZCodeParser --version 0.5.0
                    
#r "nuget: MRZCodeParser, 0.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MRZCodeParser@0.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MRZCodeParser&version=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=MRZCodeParser&version=0.5.0
                    
Install as a Cake Tool

MRZCode.NET

MRZ (machine readable zone) parser for .NET. It supports following formats:

  • TD1 (3 lines, each has 30 characters),
  • TD2 (2 lines, each has 36 characters),
  • TD3 (2 lines, each has 44 characters),
  • MRVA (2 lines, each has 44 characters),
  • MRVB (2 lines, each has 36 characters).

Implementation bases on regex patterns form ultimateMRZ project.

Samples

    public static class GenericSample
    {
        public static void Run()
        {
            var codes = new[]
            {
                @"I<UTOD231458907<<<<<<<<<<<<<<<
7408122F1204159UTO<<<<<<<<<<<6
ERIKSSON<<ANNA<MARIA<<<<<<<<<<",
                @"I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
D231458907UTO7408122F1204159<<<<<<<6",
                @"P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10",
                @"V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L8988901C4XXX4009078F96121096ZE184226B<<<<<<",
                @"V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
L8988901C4XXX4009078F9612109<<<<<<<<"
            };

            Console.WriteLine("Parsing MRZ codes sample");
            foreach (var code in codes)
            {
                Console.WriteLine();
                Console.WriteLine(code);
                Console.WriteLine();
                
                var mrzCode = MrzCode.Parse(code);

                Console.WriteLine("Code type: {0}", mrzCode.Type);

                foreach (var fieldType in mrzCode.FieldTypes)
                {
                    Console.WriteLine("{0}: {1}", fieldType, mrzCode[fieldType]);    
                }
            }
        }
    }

More samples you can find in MRZCode.Samples folder.

Change log

v. 0.5.0

Support for Belgium ID cards by tPeif

v. 0.4.0

Support for Moldavian ID cards with no expiration date by itfintech

v. 0.3.0

Support for German ID cards by daniels7

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0 2,920 7/25/2025
0.4.1 33,781 6/27/2023
0.4.0 25,911 5/27/2023
0.3.0 5,678 5/22/2021
0.2.0 825 10/29/2020
0.1.0 592 10/25/2020