---
title: "OCR Hebrew text in C#"
url: https://recursiveai.org/oneocr/cookbook/ocr-hebrew-text-csharp/
description: "Read printed Hebrew from a PNG in C# with the OneOcr Hebrew model, and save the recognized right-to-left text as UTF-8."
version: "1.2.1"
---

# OCR Hebrew text in C#

**OneOcr** is a free, open-source OCR library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneOcr.Models.Hebrew) · [GitHub](https://github.com/recursive-ai-oss/oneocr-csharp) · [Docs](https://recursiveai.org/oneocr/docs/) · [Download example (.zip)](https://recursiveai.org/oneocr/cookbook/ocr-hebrew-text-csharp/ocr-hebrew-text-csharp.zip)

```shell
dotnet add package RecursiveAI.OneOcr
dotnet add package RecursiveAI.OneOcr.Models.Hebrew
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using OneImage;
using OneOcr;

var engine = OcrEngine.LoadBundled();
var image = Image.Load("notice.png");
var options = new OcrOptions {
    Languages = ["he"] };
var text = image.ToText(engine, options);
Console.WriteLine(text);
```

Paste the code above into Program.cs of a new `dotnet new console` project and `dotnet run`, or unzip [the example](https://recursiveai.org/oneocr/cookbook/ocr-hebrew-text-csharp/ocr-hebrew-text-csharp.zip) and `dotnet run`.

The printed text in `notice.png` (included in the zip):

```text
החנות פתוחה היום
נא לסגור את הדלת
```

What the example prints:

```text
החנות פתוחה היום
נא לסגור את הדלת
```

The `he` hint selects the Hebrew recognizer. If `RecursiveAI.OneOcr.Models.Hebrew` isn’t installed, this example prints a blank line.
The page API (`image.Ocr`) reports why as diagnostic `OCR114`.

## Variations

**Save the Hebrew text as UTF-8.** Replace the print call with:

```csharp
File.WriteAllText("hebrew.txt", text);
```

## Related recipes

- [OCR a rotated or skewed page](https://recursiveai.org/oneocr/cookbook/ocr-rotated-and-skewed-page/)
- [Export OCR word boxes to TSV](https://recursiveai.org/oneocr/cookbook/export-ocr-word-boxes-to-tsv/)

---

## The short answer

Install `RecursiveAI.OneOcr.Models.Hebrew` alongside `RecursiveAI.OneOcr`. Load the image and pass it to `ToText` with a bundled engine. Use `Languages = ["he"]` for a Hebrew-only image. The model is for unpointed Hebrew: don’t use it to transcribe niqqud, the dots and other marks that indicate vowels.

## How do you convert a Hebrew photo to editable text?

The same call works with a photo in place of the PNG. Start with an upright, tightly framed image of the printed text. OneOcr can straighten tilted text by default, but the reported angle is an estimate, not a measurement of how the camera was held. Check the image and the result before treating the angle as a reason to rotate or reject a scan.

OCR returns Hebrew as text you can copy or save. It doesn’t translate that text to English. Use the `hebrew.txt` variation if your terminal displays the words poorly. An editor with Hebrew font and bidirectional text support can display the file even if the terminal cannot. If you need word positions as well as text, the [word-box recipe](https://recursiveai.org/oneocr/cookbook/export-ocr-word-boxes-to-tsv/) shows how to read the structured result instead.

## Does Hebrew OCR preserve right-to-left reading order?

OneOcr returns right-to-left lines in logical order. Hebrew letters are stored as you would type them, even though the display puts the first letter on the right. The [Unicode Bidirectional Algorithm](https://www.unicode.org/reports/tr9/) describes how a renderer lays out that text alongside left-to-right digits and words. Set the base direction to right-to-left when showing a Hebrew paragraph in an app; don’t reverse the stored string. Reversing the characters to make a particular console look right would change the text you save or search.
