Why Urdu Nastaliq Is Hard for OCR (With Real Results)
Short answer: Nastaliq is hard for OCR because its letters do not sit on one straight line. Each word slopes down from right to left, letters stack on top of each other and the gaps between words are tiny. When I ran the same four Urdu sentences through my browser OCR tool, the Naskh version came back word for word at 89% confidence, while the Nastaliq version lost about one character in five (CER 21.7%, confidence 54%). Same words, same engine, same model: only the writing style changed.
I run QuickImageToText, a free tool that reads text from images inside your browser, and it has a dedicated Urdu image to text page with the Urdu model selected for you. Urdu is where the tool is weakest, so this post shows exactly what happens, with the images I tested and the raw output.
How I tested
I wrote four short everyday Urdu sentences myself (about the weather, the market, an office time and a closed door) and rendered them two ways: in Noto Nastaliq Urdu, the style Urdu readers expect in books and newspapers, and in Noto Naskh Arabic, the flatter style used for most Arabic print. Both fonts are open source. I then made a "phone photo" copy of each with a slight tilt, paper tint, a shadow, blur, grain and JPEG compression.
Every image went through the real Urdu page in headless Chrome, the same way a visitor uses it: add the file, click Extract text, read the result box. The engine is Tesseract.js 5.1.1 with the tessdata_best Urdu model from Tesseract's best models (release 4.1.0), which is what the site runs today. I measured the character error rate (CER): the number of characters I would have to add, delete or change to fix the output, divided by the length of the correct text, ignoring spaces. 0% is perfect.
The samples



Results
| Sample | OCR setting | Confidence shown | CER |
|---|---|---|---|
| Naskh, clean | Urdu | 89% | 0% |
| Naskh, photo | Urdu | 87% | 2.4% |
| Nastaliq, clean | Urdu | 54% | 21.7% |
| Nastaliq, clean | Urdu + Black and white | 53% | 22.9% |
| Nastaliq, photo | Urdu | 59% | 26.5% |
| Nastaliq, photo | Urdu + Black and white | 52% | 31.3% |
| Nastaliq, clean, larger (64 px) | Urdu | 34% | 68.7% |
| Naskh, clean | Arabic | 74% | 37.3% |
| Naskh, clean | Auto, English browser | 74% (read as Arabic) | 37.3% |
| Nastaliq, clean | Auto, English browser | 21% (read as English) | 100% |
| Nastaliq, photo | Auto, English browser | 41% (read as Japanese) | 100% |
Two older runs I logged on this site agree with these numbers. In October I measured CER 15.1% on a clean Nastaliq image and 24.5% on a phone style one, and a different three line Nastaliq sample on the Urdu page came back at 63% confidence with CER 11.3%. Nastaliq has never come close to the near perfect Naskh result.
What failed, letter by letter
Here is the clean Nastaliq output for the first and last lines, next to what the image says:
| Image says | OCR returned | What went wrong |
|---|---|---|
| آج موسم بہت اچھا ہے۔ | آج موکم بہت اچھا ہے۔ | س read as ک |
| براہ کرم دروازہ بند رکھیں۔ | را گرم وروازوبند رھیں۔ | ب dropped, ک read as گ, د read as و, ہ read as و, two words joined, ک dropped |
The other two lines showed the same patterns: خریدی became غریدی (a dot appeared), دس became وس, بجے lost its ج, دفتر became دن and بازار سے ran together as one word. Almost every mistake falls into one of four groups:
- Letters that change height inside a word. In Nastaliq, the start of a word sits high and the end drops to the baseline. Letters in the middle of a slope, like the ج in بجے, are the ones that vanish.
- Dots in the wrong place. Dots of one letter often sit above or below a neighbouring letter, so خ and غ or ک and گ swap.
- Look-alike shapes. Final ہ and و, and initial د and و, are very close in Nastaliq, and the model mixes them up.
- Missing word gaps. Nastaliq words overlap sideways, so the space between دروازہ and بند is narrower than the space inside some words, and the two get merged.
Why Naskh works and Nastaliq does not
Tesseract reads text one line at a time. It first finds the lines, then passes each line image to a neural network that outputs characters. That design assumes text runs along a mostly straight baseline. Naskh mostly does. Nastaliq is built on diagonal strokes: each word steps down at an angle, letters climb on top of each other, and words from one line can reach into the space of the next.
My working explanation, which matches what I see in the errors above, is that the Urdu model was trained mostly on Naskh style text. Every Naskh run was close to perfect, and every Nastaliq run failed in the places where the slope is steepest. Within Tesseract, I have not found a better option: in an earlier round, the generic Arabic script model and an Urdu plus Arabic mix both did worse than the plain Urdu model.
There are research models built only for printed Nastaliq, such as UTRNet, but they need a different runtime and I have not tested them in the browser.
Three results that surprised me
Bigger was worse. I expected the 64 px Nastaliq image to read better than the 40 px one. It read much worse: confidence fell to 34% and two whole lines turned into fragments. I have no confident explanation, so I only report it: a higher resolution scan will not necessarily fix Nastaliq.
Black and white did not help. On a clean or phone style Nastaliq image, the Black and white option gave slightly worse results.
Auto cannot see Nastaliq as Arabic script. With Auto selected and an English browser, the tool read the Nastaliq samples as English and as Japanese, and the output was useless. On the Naskh sample, Auto found the Arabic script but chose the Arabic model, which has no ہ or ے, so they came out as ب and ي. The Urdu page selects Urdu for you, which avoids both problems. On any other page, pick Urdu yourself.
Practical tips for Urdu OCR
- Pick Urdu, not Auto or ArabicUse the Urdu image to text page, or choose Urdu in the language list. The Arabic model drops Urdu letters even on perfect text.
- Use Naskh when you control the sourceIf you are making a form, a notice or a document that someone will scan later, set the Urdu in a Naskh font. In my tests that alone moved the result from about one wrong character in five to none.
- Prefer a screenshot over a photoFor text on a screen, a screenshot avoids blur and tilt, which made Nastaliq worse in my tests. The screenshot to text page covers that case.
- Read the confidence lineEvery Nastaliq run in this test scored below 60%, and the tool shows a warning under that. Treat it as "check every word", not "try again".
- Proofread the usual suspectsLook for joined words, dropped letters in the middle of words, and ک/گ, خ/غ, د/و and ہ/و swaps. These were most of my errors.
If your text is Arabic or Persian rather than Urdu, the same Naskh advantage applies, and the Arabic image to text page selects the Arabic model for you. Once the text is right, you can save it as a Word file from the result box or with the image to Word page.
FAQ
Can OCR read Urdu Nastaliq at all?
Yes, but not reliably. In my tests the plain Urdu model read clean Nastaliq with a character error rate between 11% and 22% depending on the sample, and phone style photos were worse. In my samples some whole lines came through intact; letters in the middle of sloping words are the ones that go missing.
Why does the Urdu page read Naskh Urdu so well?
Naskh keeps every letter on one flat baseline, which is what Tesseract's line reader expects. My Naskh samples came back word for word at 87% to 89% confidence, even as a tilted photo.
Should I use the Arabic option for Urdu text?
No. The Arabic model has no ہ or ے, so it replaced them with ب and ي and the error rate rose to 37% on a sample that the Urdu model read perfectly.
Is my Urdu document uploaded anywhere?
No. The model is downloaded to your browser and the reading happens on your device. The image is not sent to my server.
Have an Urdu page to try? Open the Urdu image to text tool, add your image and check the confidence line. It runs in your browser and nothing is uploaded.