👀 Live Preview
Same text with and without dir="rtl" override:
Normal: Hello World!
RTL override: Hello World!

By the end of this tutorial, you’ll confidently override text direction for multilingual and mixed-language content.
Wrap text in <bdo> with the required dir attribute.
Force ltr or rtl display when direction is known.
Override direction explicitly vs isolate auto-detected text.
Embed Arabic in English or reverse LTR text for demos.
Force English phrases to display correctly on RTL pages.
Ship bdo markup with universal browser compatibility.
<bdo> Tag?The bidirectional override element (<bdo>) forces the text direction of its contents. Unlike <bdi>, which isolates auto-detected text, <bdo> requires you to set dir="ltr" or dir="rtl" explicitly.
bdo stands for Bidirectional Override. It overrides the Unicode bidirectional algorithm so text renders in the direction you specify—essential when you know the intended reading order.
Common uses include reversing LTR text for demonstration, embedding RTL Arabic in English prose, and forcing LTR English inside fully RTL pages.
Wrap text in <bdo> and set the required dir attribute:
<bdo dir="ltr">Left-to-right text</bdo>
<bdo dir="rtl">Right-to-left text</bdo><bdo> is an inline element—it nests inside paragraphs, headings, and lists.dir attribute is required and accepts only ltr or rtl.<bdo />) is not valid in HTML.| Use Case | Code Snippet | Result |
|---|---|---|
| Force RTL | <bdo dir="rtl">Hello</bdo> | Hello |
| Force LTR | <bdo dir="ltr">English</bdo> | English |
| Arabic in English | <bdo dir="rtl">قلب</bdo> | قلب |
| vs bdi isolate | <bdi>...</bdi> | Auto direction, no override |
| Required attr | dir="ltr" | "rtl" | Must be present on every bdo |
| RTL page + English | <bdo dir="ltr">Hello</bdo> | Hello |
<bdo> vs <bdi>Both handle bidirectional text, but they solve different problems:
| Element | Behavior | Best for |
|---|---|---|
<bdo> | Override with required dir | Known direction—reversing LTR, embedding English in RTL |
<bdi> | Isolate; auto direction | Dynamic or unknown text (usernames, comments) |
dir on span | Set on any element | Block-level content when semantics allow |
| Page-level | <html dir="rtl"> | Fully right-to-left documents |
<!-- Force RTL display -->
<bdo dir="rtl">Hello World!</bdo>
<!-- Isolate unknown username -->
<bdi>إيان</bdi>The dir attribute is required on <bdo>. It accepts only ltr or rtl:
dir RequiredForces left-to-right or right-to-left display of enclosed text.
dir="rtl"class / id GlobalHook for CSS selectors and JavaScript targeting.
<bdo class="rtl-text">lang A11yHints the language of overridden text for screen readers.
lang="ar"<bdo dir="rtl" lang="ar">Your right-to-left text here</bdo>Three direction-override patterns with copy-ready code, live previews, and hands-on practice.
Same text with and without dir="rtl" override:
Normal: Hello World!
RTL override: Hello World!
Force text to render right-to-left with dir="rtl", even inside an LTR page.
<bdo dir="rtl">Your Right-to-Left Text Here</bdo>Here are the most frequent ways developers use the <bdo> tag.
Embed an RTL Arabic word in English prose, or reverse LTR text for demonstration purposes.
<p>
The <bdo dir="rtl">قلب</bdo> of the matter lies in bi-directional support.
</p>
<p>
Reversed: <bdo dir="rtl">Hello World!</bdo>
</p>On a right-to-left page (dir="rtl" on <html>), use <bdo dir="ltr"> so English phrases display correctly.
<html lang="ar" dir="rtl">
<p>
النص العربي،
<bdo dir="ltr">Hello World</bdo>
بالإنجليزية.
</p>
</html>Handle direction carefully for all readers:
<bdo>dir on <html> for fully RTL or LTR pages<meta charset="UTF-8"> for Arabic, Hebrew, and other scriptsChoose ltr or rtl based on how the text must display.
The Unicode bidirectional algorithm is overridden inside the bdo boundary.
Text renders in the forced direction—RTL reverses character order for LTR source text.
Mixed-language pages display each phrase in the intended reading direction.
The <bdo> tag is supported in all browsers, including Internet Explorer.
From legacy IE to the latest mobile browsers — bidirectional override has been a core HTML feature for decades.
Bottom line: Ship bidirectional override markup with confidence. Use <bdo dir> in every production environment today.
The <bdo> tag gives you explicit control over text direction when the Unicode algorithm alone is not enough. Always pair it with dir="ltr" or dir="rtl", prefer <bdi> for unknown dynamic content, and set page-level dir on <html> for fully directional layouts.
dir="ltr" or dir="rtl" on <bdo><bdi> for unpredictable user-generated textdir on <html> for fully RTL or LTR pagesdir attribute—it is required<bdo> when <bdi> is the better choice<bdo>Bookmark these before you ship — they’ll keep mixed-language UI readable and accessible.
<bdo> = Bidirectional Override—forces text direction explicitly.
Every <bdo> must have dir="ltr" or dir="rtl".
Forces text direction, overriding the Unicode bidirectional algorithm.
Behavior<bdi> isolates; <bdo> overrides with explicit dir.
Use dir="ltr" to embed English correctly on RTL pages.
Supported in all browsers, including Internet Explorer.
Compatibilitydir="ltr" or dir="rtl" to force how the enclosed text displays.<bdo> element must have dir="ltr" or dir="rtl".<bdo> forces direction with dir. <bdi> isolates text and auto-detects direction—better for unknown usernames and dynamic content.<bdo> for semantic inline overrides. For block content, dir on p or div is often simpler and equally effective.Open the Try It editor and experiment with dir="rtl" and dir="ltr" on bdo elements.
7 people found this page helpful