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 ImageUse 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.
-
1Install IronOCR with NuGet Package Manager
-
2Copy and run this code snippet.
var input = new IronOcr.OcrInput(); input.LoadImage("micr.png", new IronSoftware.Drawing.Rectangle(125, 240, 310, 15)); string micrText = new IronOcr.IronTesseract { Language = IronOcr.OcrLanguage.MICR }.Read(input).Text;C# -
3Deploy to test on your live environment
Start using IronOCR in your project today with a free trial
Minimal Workflow (5 steps)
- Download the C# library for reading MICR cheques
- Instantiate the OCR engine
- Set the
Languagesetting to MICR - Use the
Readmethod to extract data from the sample cheque image - Access the OcrResult property to view and manipulate the extracted data
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?

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?
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);
}Imports IronOcr
Imports IronSoftware.Drawing
Imports System
' Create a new instance of IronTesseract for performing OCR operations
Dim ocr As 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 input As New OcrInput()
' Specify the MICR of the image to focus on for OCR (coordinates in pixels)
Dim contentArea As 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
Dim 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
Dim transitNum As String = result.Text.Substring(0, 7)
' Routing number starts from the 8th character and is 11 characters long
Dim routingNum As String = result.Text.Substring(7, 11)
' Account number starts from the 22nd character to the end of the string
Dim accountNum As String = result.Text.Substring(22)
End UsingThe 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?

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 is typically high due to the standardized E-13B 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

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);
}
});Imports System.IO
Imports System.Threading.Tasks
Imports IronOcr
' Process multiple cheques in parallel
Dim chequeFiles = Directory.GetFiles("cheques/", "*.png")
Parallel.ForEach(chequeFiles, Sub(file)
Using ocr As New IronTesseract With {.Language = OcrLanguage.MICR}
Using input As New OcrInput()
input.LoadImage(file, micrRegion)
Dim result = ocr.Read(input)
ProcessMicrData(result.Text)
End Using
End Using
End Sub)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.
Related Financial Document Processing
IronOCR's capabilities extend beyond check processing. Explore these related features for comprehensive financial document automation:
- Extract data from scanned invoices
- Process identity documents for KYC compliance
- Read tables in financial statements
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 in the context of check processing?
MICR stands for Magnetic Ink Character Recognition, a technology used in check processing. It employs a special magnetic ink and a unique font (E-13B) to encode details like routing numbers and account numbers on checks. IronOCR can accurately read these details to automate the extraction process.
How do I set up IronOCR to read a MICR line from a check?
To read a MICR line using IronOCR, you need to set the `Language` property of `IronTesseract` to `OcrLanguage.MICR`. Load the image containing the MICR text using the `OcrInput` class, specify the rectangular region of the MICR line, and use the `Read()` method to extract the text.
What type of information does the MICR line contain?
A MICR line typically includes a check number, a routing number, and an account number. The routing number identifies the financial institution, the account number specifies the customer's account, and the check number is unique to each check.
Can IronOCR handle variations in MICR line positions on checks?
Yes, IronOCR allows you to specify the exact rectangular region to read from, which can handle variations in MICR line positions across different check formats. You can also implement dynamic region detection for additional flexibility.
How can I improve OCR accuracy for low-quality check scans?
For low-quality scans, you can apply image preprocessing filters provided by IronOCR to enhance the readability of the MICR line before extraction. These filters can significantly improve OCR accuracy.
What are the benefits of using IronOCR for check processing?
IronOCR automates the reading of MICR lines, reducing manual data entry errors and speeding up the check processing workflow. It offers high accuracy, even for slightly damaged checks, thanks to its specialized MICR engine.
Does IronOCR support multithreading for processing multiple checks?
Yes, IronOCR supports multithreading, allowing you to process multiple checks simultaneously. This feature can significantly improve performance, especially in high-volume environments.
What other financial document processing capabilities does IronOCR offer?
Beyond MICR reading, IronOCR can extract data from scanned invoices, process identity documents for KYC compliance, and read tables in financial statements, providing comprehensive automation for financial documents.
How can I verify the extracted MICR data using IronOCR?
IronOCR provides an `OcrResult` object that includes the extracted text, confidence levels, and additional data like words and lines. You can also visualize the targeted OCR region on the input image to ensure correctness.
What should I do if IronOCR incorrectly recognizes characters in the MICR line?
Ensure that the MICR language pack is up to date and correctly installed. The specialized MICR language configuration in IronOCR is specifically designed for recognizing the E-13B font used in MICR lines.

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.