How to Read MICR Cheque using IronOCR in C#

Manually processing checks is slow and error-prone. IronOCR streamlines this workflow with a specialized engine that accurately reads the MICR (Magnetic Ink Character Recognition) line, letting you automate the extraction of routing numbers, account numbers, and other critical data.

Quickstart: OCR Read MICR from Cheque Image

Use IronOCR to grab the MICR line fast—just set the Language to MICR, specify the rectangular region where the MICR text appears, run Read(), and immediately get the result.Text string. Perfect for developers who want reliable financial data extraction with minimal setup.

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronOCR with NuGet Package Manager

    PM > Install-Package IronOcr

  2. Copy and run this code snippet.

    string micrText = new IronOcr.IronTesseract { Language = IronOcr.OcrLanguage.MICR }.Read(new IronOcr.OcrInput().LoadImage("micr.png", new System.Drawing.Rectangle(125, 240, 310, 15))).Text;
  3. Deploy to test on your live environment

    Start using IronOCR in your project today with a free trial
    arrow pointer

How Do I Read MICR Data from a Cheque Image?

Reading a MICR line with IronOCR is simple and intuitive. Begin by setting the Language property of the IronTesseract instance to OcrLanguage.Micr. To ensure the engine reads the correct area, specify the location of the MICR line by setting a rectangular boundary on the OcrInput.

This is achieved by selecting the x and y coordinates, as well as the height and width of the bounding box rectangle, then passing the rectangle as the second parameter when calling the Load method. Calling the Read method then processes only this defined region. This combination of the MICR language setting and a specific region guarantees that IronOCR accurately extracts the relevant financial information.

MICR technology uses special magnetic ink and a unique font (E-13B in North America) that contains exactly 14 characters: the digits 0-9 and four special symbols. These symbols include the transit symbol (⑆), which marks routing number boundaries; the on-us symbol (⑈), which separates the account number from other data; the amount symbol (⑊), used for encoded amounts; and the dash symbol (⑉), which serves as a separator. The magnetic properties of this ink allow for reliable reading even when checks are folded, stamped, or slightly damaged, making MICR ideal for high-volume check processing.

What Does a MICR Cheque Look Like?

Sample check showing MICR line with routing number, account number, and check number labeled for MICR reading demonstration

What Information Does the MICR Line Contain?

Check Number: This number uniquely identifies the specific cheque from the account holder's checkbook. It serves as a clear reference for tracking individual payments and maintaining transaction records. In automated processing systems, the check number helps prevent duplicate processing and assists in reconciliation procedures.

Routing Number: This nine-digit code, enclosed by the ⑆ transit symbol, identifies the financial institution that holds the account. It's the first piece of information a clearinghouse uses to direct the cheque to the correct bank for payment. The routing number follows a specific format: the first four digits identify the Federal Reserve routing symbol, the next four identify the institution, and the final digit is a checksum for validation.

Account Number: This identifies the specific customer account from which funds will be drawn. Its length can vary between different banks, typically ranging from 10 to 12 digits. Banks may include internal codes or branch identifiers within the account number structure.

What Code Do I Need to Extract MICR Data?

:path=/static-assets/ocr/content-code-examples/how-to/read-micr-cheque.cs
using IronOcr;
using IronSoftware.Drawing;
using System;

// Create a new instance of IronTesseract for performing OCR operations
IronTesseract ocr = new IronTesseract();

// Set the OCR language to MICR to recognize magnetic ink characters
// Must have MICR (IronOcr.Languages.MICR) installed beforehand
ocr.Language = OcrLanguage.MICR;

// Specify the file path of the input image containing MICR text
using (var input = new OcrInput())
{
    // Specify the MICR of the image to focus on for OCR (coordinates in pixels)
    var contentArea = new Rectangle(x: 215, y: 482, width: 520, height: 20);
    input.LoadImage("micr.png", contentArea);

    // Optional: Save the cropped area for verification
    input.StampCropRectangleAndSaveAs(contentArea, Color.Aqua, "cropped.png");

    // Run the OCR engine to read the MICR text from the input image
    var result = ocr.Read(input);
    // Output the recognized text to the console
    Console.WriteLine(result.Text);

    // Transit number is the first 7 characters of the MICR string
    string transitNum = result.Text.Substring(0, 7);
    // Routing number starts from the 8th character and is 11 characters long
    string routingNum = result.Text.Substring(7, 11);
    // Account number starts from the 22nd character to the end of the string
    string accountNum = result.Text.Substring(22);
}
$vbLabelText   $csharpLabel

The code demonstrates the complete workflow for MICR cheque processing. Before running this code, ensure you've installed the MICR language pack via NuGet. The OcrInput class provides powerful methods for loading and preprocessing images, while the Rectangle parameter allows precise targeting of the MICR line location.

What Results Should I Expect?

Debug console showing MICR parsing results with transit, routing, and account numbers extracted from check

The output above shows the three sections obtained from the MICR cheque: the transit number, the routing number, and the account number. Notice how the special MICR symbols are represented in the output—this is normal behavior as these symbols have specific Unicode representations that may appear differently in console output.

MICR OCR Results

The OcrResult object provides detailed information about the scan:

Text: The extracted text from OcrInput. This includes all characters and symbols from the MICR line, maintaining their original sequence.

Confidence: Indicates the statistical accuracy confidence of an average of every character, with one being the highest and zero being the lowest. For MICR reading, confidence levels above 0.9 are typical due to the standardized font design. Learn more about confidence tracking in OCR results.

Blocks, Paragraphs, Lines, and Words: The hierarchical structure of recognized text, which for MICR typically consists of a single line with multiple word segments separated by symbols.

Barcode Data: While processing MICR, IronOCR can simultaneously detect any barcodes or QR codes present on the check.

How Can I Verify the Correct OCR Region?

To ensure you've selected the correct coordinates for the MICR line, you can visualize the ContentArea you defined. A simple way to do this is to draw the rectangle on the input image and save it as a new file with StampCropRectangleAndSaveAs. This helps you debug and fine-tune the coordinates for optimal performance.

To find the coordinates for your Rectangle, use a simple image editor like MS Paint. Open your cheque image, hover your mouse over the top-left and bottom-right corners of the MICR line, and note the (x,y) pixel coordinates. You can then calculate the rectangle's properties: (x1, y1, width, height), where width = x2-x1 and height = y2-y1.

For more advanced region selection techniques, explore OCR region targeting and content areas with PDFs.

Here is the output image after drawing the specified bounding box on our example cheque.

Output

Check MICR line showing routing number, account number, and check number highlighted in red box

The light blue rectangle confirms that we have correctly isolated the MICR line for processing.

Performance Optimization Tips

When processing multiple checks, consider implementing multithreading for improved performance. IronOCR handles concurrent operations efficiently:

// Process multiple cheques in parallel
var chequeFiles = Directory.GetFiles("cheques/", "*.png");
Parallel.ForEach(chequeFiles, file =>
{
    using (var ocr = new IronTesseract { Language = OcrLanguage.MICR })
    using (var input = new OcrInput())
    {
        input.LoadImage(file, micrRegion);
        var result = ocr.Read(input);
        ProcessMicrData(result.Text);
    }
});
// Process multiple cheques in parallel
var chequeFiles = Directory.GetFiles("cheques/", "*.png");
Parallel.ForEach(chequeFiles, file =>
{
    using (var ocr = new IronTesseract { Language = OcrLanguage.MICR })
    using (var input = new OcrInput())
    {
        input.LoadImage(file, micrRegion);
        var result = ocr.Read(input);
        ProcessMicrData(result.Text);
    }
});
$vbLabelText   $csharpLabel

Common Troubleshooting Scenarios

Low Quality Scans: If you're working with poor quality check images, apply image preprocessing filters to enhance readability. The MICR font's distinctive shape helps maintain accuracy even with degraded images.

Incorrect Character Recognition: Ensure you have the latest MICR language pack installed. The specialized MICR language configuration is specifically trained for E-13B font recognition.

Variable MICR Line Positions: Different banks may position the MICR line at slightly different locations. Consider implementing dynamic region detection or maintaining a configuration file with coordinates for different check formats.

IronOCR's capabilities extend beyond check processing. Explore these related features for comprehensive financial document automation:

By mastering MICR reading with IronOCR, you've taken the first step toward fully automated financial document processing, reducing manual entry errors and accelerating your workflow significantly.

Frequently Asked Questions

What is MICR and why is it important for check processing?

MICR (Magnetic Ink Character Recognition) is a technology that uses special magnetic ink and unique fonts to encode financial information on checks. IronOCR's specialized MICR engine can accurately read this encoded data, including routing numbers, account numbers, and check numbers, automating what would otherwise be a slow and error-prone manual process.

How do I configure the OCR engine to read MICR text?

To read MICR text with IronOCR, you need to set the Language property of the IronTesseract instance to OcrLanguage.MICR. This tells the engine to use the specialized MICR character recognition algorithms designed specifically for reading the E-13B font used on checks.

Can I specify exactly where on the check to look for MICR data?

Yes, IronOCR allows you to specify the exact location of the MICR line by setting a rectangular boundary on the OcrInput. You define this by selecting the x and y coordinates, along with the height and width of the bounding box rectangle, then passing it as the second parameter when calling the Load method.

What special characters are used in MICR encoding?

MICR uses 14 characters total: digits 0-9 and four special symbols. These include the transit symbol (⑆) for routing number boundaries, the on-us symbol (⑈) to separate account numbers, the amount symbol (⑊) for encoded amounts, and the dash symbol (⑉) as a separator. IronOCR can recognize all these MICR-specific characters.

How quickly can I extract MICR data from a check image?

With IronOCR, you can extract MICR data in just one line of code. Simply create an IronTesseract instance with Language set to MICR, load your image with the MICR region specified, call Read(), and access the result.Text property to get the extracted MICR string immediately.

What types of financial information can be extracted from the MICR line?

IronOCR can extract all the critical financial data encoded in the MICR line, including the routing number (identifying the bank), account number (identifying the specific account), and check number (uniquely identifying the individual check). This automated extraction streamlines financial document processing.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 5,283,947 | Version: 2025.12 just released