Glossary · Arabic & RTL

Two directions, one line of text.

An Arabic sentence with an English product name, an email address or a phone number in it is bidirectional text. Most of the time it displays fine. When it does not, punctuation jumps, numbers swap places, and the fix is almost always isolation.

Updated 19 November 2026Sources checked 16 November 2026Reviewed by Eng. Hasan Kassas

What it means

Bidirectional text, or bidi, is text that mixes right-to-left and left-to-right runs, such as an Arabic sentence containing a Latin brand name, an email address or a phone number. Software decides its display order with the Unicode Bidirectional Algorithm (UAX #9), which gives every character a direction type and works out the rest from its neighbours.

The algorithm sorts characters into three broad groups. Strong characters have a fixed direction: Arabic letters are right-to-left, Latin letters left-to-right. Weak characters, mainly digits and the signs that travel with them, take part in ordering numbers but never set the direction of a paragraph. Neutral characters, such as spaces and most punctuation, have no direction of their own and borrow one from the text around them. Most surprises come from that borrowing, when a full stop or a space sits between two runs and has to be assigned to one of them.

The direction of a whole paragraph comes from markup (dir="rtl") or, with dir="auto", from its first strong letter. In our tests on 16 November 2026, "Hello مرحبا" with dir="auto" resolved to left-to-right in Chrome 157, and our first-strong helper returned right-to-left for "2026 آيفون": the leading digits are weak, so the first Arabic letter decides. A string with no letters at all, such as +963 933 123 456, has no strong direction and takes one from its context.

Names

What it is called

NameNotes
EnglishBidirectional text, bidiAlso "mixed-direction text". The rules are the Unicode Bidirectional Algorithm.
Modern Standard Arabicالنص ثنائي الاتجاهSometimes «النص مختلط الاتجاه».
Also heard in Syriabidi, «عربي وإنكليزي بنفس السطر»Developers often keep the English word; others simply describe the problem.
In code or standardsUAX #9, <bdi>, dir="auto", unicode-bidiPlus the isolate characters FSI (U+2068) and PDI (U+2069) for plain text.

An example from a Syrian app

Take a course listing in an education app in Homs: «دورة C++ للمبتدئين، تبدأ السبت». The Arabic words run right to left and the name of the programming language runs left to right. The two plus signs are neutral, and they sit between the Latin C and the Arabic word that follows it. With nothing else to go on, the algorithm gives them the direction of the surrounding Arabic, so they are drawn on the far side of the C and the reader sees ++C.

Wrap the course name in <bdi> on a web page, or between FSI and PDI in a push notification, and the name is laid out on its own first, as one left-to-right unit, before it is placed in the Arabic sentence. Anything dropped into a sentence from a variable, such as a seller name or a phone number in an SMS template, deserves the same treatment: you cannot know in advance how it starts or ends.

Isolation

Ways to keep inserted text in order

WhereWhat it does
<bdi>HTML, around inserted textIsolates its content. In our test, Chrome 157 gave it unicode-bidi: isolate by default.
dir="auto"HTML, on any elementSets the element's direction from its first strong letter.
FSI + PDI (U+2068, U+2069)Plain text: SMS, push, titles, CSVTwo invisible characters that wrap inserted text as an isolated run.
unicode-bidi: isolate-overrideCSS, for digit groupsForces the element's own direction on every character inside it; fixes the Arabic-Indic digit case below.
In practice

Where it matters

  • Names, titles and handles. User names, product titles, brand names, email addresses and links arrive in either script, and the last two are full of neutral dots, @ signs and slashes.
  • Numbers inside sentences. Phone numbers, order numbers and codes need a direction of their own: <bdi> or a span with dir="ltr".
  • Text with no markup: SMS bodies, push notifications, page titles and CSV exports. Here the isolate characters do the work, and our tested helper wraps inserted text in them.
Pitfalls

Common mistakes

  • Arabic-Indic digits with spaces. Typed as ٠٩٣٣ ١٢٣ ٤٥٦, a phone number showed its groups in reverse order in Chrome 157 even inside an element with dir="ltr" (tested 16 November 2026). The algorithm classes ٠ to ٩ as Arabic numbers, a type that counts as right-to-left when the spaces between groups are resolved, so the groups trade places. In the same test, unicode-bidi: isolate-override kept the typed order, and so does writing the number as one run with no spaces. More under Arabic-Indic digits.
  • Guessing a paragraph's direction from the interface language. A comment written in English inside an Arabic app is still English; let dir="auto" read its first strong letter.
  • Gluing strings together in code. Building «السعر: » + name + « فقط» and handing it to a view without isolation leaves the order to chance. Our test page wraps the name in <bdi>, and the paragraph stayed right-to-left.
FAQ

Common questions

Text that contains both right-to-left and left-to-right runs, for example Arabic with an English name or a number in it. The Unicode Bidirectional Algorithm decides how it is displayed.

Sources

Where these facts come from

  1. UAX #9: Unicode Bidirectional AlgorithmUnicode Consortium · accessed 16 Nov 2026
  2. Inline markup and bidirectional text in HTMLW3C Internationalization · accessed 16 Nov 2026
  3. <bdi>: the bidirectional isolate elementMDN Web Docs · accessed 16 Nov 2026
  4. The dir global attributeMDN Web Docs · accessed 16 Nov 2026

Behaviour measured in headless Chrome 157 and with Node 24 on 16 November 2026.

Arabic and English tangled on your screens?

Send us a screenshot of a line that reads wrong and we will find the character behind it.