Why Arabic or Urdu text comes out backwards
Computers store Arabic and Urdu in the order you read them, then draw each line from right to left. If the OCR engine, the PDF or the app you paste into gets that rule wrong, you see words or whole lines in reverse. First find out which of the three is at fault, then fix that one.
By the FastOCR team · Published · 7 min read
Who this is for
- Anyone who pasted Arabic, Urdu, Farsi, Pashto or Hebrew text from OCR or a PDF and saw it reversed or jumbled.
- You need a word processor or spreadsheet. No technical knowledge is assumed.
On this page
- What does “backwards” actually mean here?
- Who can get the order wrong?
- How do I find which one is at fault?
- How do I fix it in Word?
- How do I fix it in Google Docs?
- How do I fix it in Excel?
- Why do numbers inside Arabic or Urdu text jump around?
- What does FastOCR do with right-to-left text?
- Frequently asked questions
What does “backwards” actually mean here?
It means the order of the text and the order it is drawn have come apart. Computers keep Arabic and Urdu in logical order: the first letter you read is the first one stored. The screen then draws that line from right to left. That drawn order is called visual order.
Everything works while each program agrees on the rule. Trouble starts when one of them stores or treats the text the other way round.
Take the Arabic word كتاب (“book”). In logical order its letters are stored k-t-a-b. If a program reverses them, you get the same four letters in the wrong order, and the word is wrong or the letters detach.
Who can get the order wrong?
Three places: the OCR engine, the PDF text layer, and the app you paste into. Always find which one failed before you try fixes.
- The OCR engine reads the picture and returns text. Some engines return right-to-left lines with the words in reverse.
- The PDF text layer is the hidden text behind a scanned page that lets you select and copy (how to tell if a PDF has one). Some are stored in drawn order, so a viewer has to reverse it when you copy, and viewers do not all do that the same way.
- The app you paste into decides the direction of each paragraph. A paragraph set to left to right will lay out Arabic wrongly even when the text is correct.
How do I find which one is at fault?
Paste the text into a plain text editor, such as Notepad or TextEdit in plain mode. A plain editor does not carry paragraph settings from a document, so it shows what the text itself looks like.
- Copy the text from the OCR result or PDF.
- Paste it into the plain text editor.
- If the words are in the wrong order there, the engine or the PDF text layer is at fault. Try another viewer for the PDF, or another OCR tool.
- If it reads correctly there but looks wrong in Word, Docs or Excel, the app’s paragraph direction is at fault. Use the fixes below.
How do I fix it in Word?
Select the text and set the paragraph direction to right to left. In Word on Windows this is the right-to-left button in the Home tab, in the Paragraph group; it only shows when a right-to-left language is enabled in Word’s language settings.
If you cannot find the button, add Arabic or Urdu as an editing language in Word’s options, then restart Word. After that, select the paragraphs and click the button. Word will also line up numbers and punctuation with the right edge. If you open a FastOCR Word export, right-to-left paragraphs already carry this setting.
How do I fix it in Google Docs?
Turn on right-to-left text for the paragraph. Google Docs shows a right-to-left text button in the toolbar once a right-to-left language is enabled, and you then click it with your paragraph selected.
The place to enable the language has moved between versions, so look in the document’s language settings under the File menu, or in the language preferences of your Google account. If you cannot find the button, search the Docs help for “right-to-left” to see the current steps. Select the text, click the button, and the paragraph should flip to start at the right edge.
How do I fix it in Excel?
Change the text direction of the cells, or of the whole sheet. In Format Cells, on the Alignment tab, there is a text direction setting with a right-to-left choice. There is also a sheet-level setting that mirrors the sheet so column A sits at the right.
Use the cell setting when only a column of names is Arabic. Use the sheet setting when the whole table is right to left. The setting names depend on your version and on which languages are enabled, so if you do not see them, enable a right-to-left language first.
Why do numbers inside Arabic or Urdu text jump around?
Because numbers and Latin words run left to right even inside a right-to-left sentence. The program has to decide where they sit, and it uses the paragraph direction to do that.
A phone number or a date in a left-to-right paragraph can lose its place, or a bracket can flip to face the wrong way. Setting the paragraph to right to left usually settles it. Persian and Urdu digits, such as ۱۳۸۶, are also treated as numbers rather than letters, which is the rule the standard sets. If a figure still looks wrong, retype just that part.
What does FastOCR do with right-to-left text?
Its searchable PDFs are built so that copying a right-to-left line gives it back in reading order, and on pages set in columns of running text, the right-hand column is read first. In Word exports the text stays in reading order and right-to-left paragraphs are marked, so Word sets their direction.
Some PDF viewers still scramble Latin words or brackets inside Arabic lines when you copy. That is the viewer, not the file. If it happens, try another viewer. You can try it yourself on Arabic OCR or Urdu OCR, and the broader reasons these scripts are hard are in our guide to non-Latin scripts.
Frequently asked questions
Why does my Arabic text look backwards after I paste it?
Usually the app you pasted into is laying out the text left to right. The letters are in the right order in the file, but the paragraph is set to run left to right, so the line starts on the wrong side or words appear in the wrong sequence. Switching the paragraph to right to left often fixes it.
Is it the OCR that got the order wrong?
Sometimes. A few OCR engines return each right-to-left line with its words reversed. A quick test is to paste the result into a plain text editor. If the words are still in the wrong order there, the engine, not your word processor, caused it.
Why do the numbers in my Arabic or Urdu sentence jump around?
Numbers and Latin words run left to right even inside a right-to-left sentence. If the paragraph direction is wrong, the numbers can move to the other end of the line or swap order. Setting the paragraph to right to left usually puts them back.
Will find and replace fix reversed words?
No. Reversing words by hand with find and replace is slow and easy to get wrong. Change the paragraph direction first. Only if the text is still wrong in a plain text editor should you re-run the OCR with a different tool.
Read an Arabic page and check the order
Upload an image or PDF and compare the result with the original. Searchable PDFs copy right-to-left lines back in reading order.
Related guides
Sources
How we wrote this
The people who build FastOCR wrote this from our own testing and from how the product works today. We draft with AI help, then check every claim about FastOCR against the product. If something here is wrong or out of date, tell us and we will correct it.