HTML <bdo> Tag

Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview

Definition and Usage

The <bdo> element (Bidirectional Override) forces the direction of its text with dir="ltr" or dir="rtl", overriding the Unicode bidirectional algorithm for that span.

Characters are laid out from the chosen starting side; they are not drawn mirrored or backward. Prefer <bdi> when direction is unknown and you only need isolation.

Baseline · Widely available.

Not deprecated. Stable across major browsers since about July 2015.

dir is required in practice.

Always set dir to ltr or rtl. Without it, override has no useful direction to apply.

HTML Syntax

syntax.html
<bdo dir=" ltr|rtl">text</bdo>

Both start and end tags are required. Content is phrasing content.

Attributes

The attribute you must use on <bdo>:

AttributeDescriptionTry it
dirRequired for useful override: ltr (left-to-right) or rtl (right-to-left)Try it
langOptional language of the overridden spanTry it

Global Attributes

The <bdo> tag also supports the Global Attributes in HTML.

Live Preview

Flip dir on a real <bdo> and watch the same characters change layout direction.

A real <bdo>. Apply ltr or rtl to force direction.

Override

This text will follow the chosen direction.

dir="ltr"

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Force Right-to-Left

Override an English sentence so characters are laid out from the right.

HTML
<p>This text will go left to right.</p>
<p>
  <bdo dir="rtl">This text will go right to left.</bdo>
</p>
Try It Yourself

How It Works

  1. Wrap the span you want to override in <bdo>.
  2. Set dir="rtl" to force right-to-left layout.
  3. Characters keep their normal shapes — only the flow direction changes.
  4. Surrounding paragraphs stay in the page default direction.

Example 2 — Force Left-to-Right

Use dir="ltr" when you must keep a left-to-right reading order.

HTML
<p>
  Forced LTR:
  <bdo dir="ltr">CodeToFun 2026</bdo>
</p>
Try It Yourself

How It Works

  1. Open with <bdo> and set dir="ltr".
  2. Put the text inside that must stay left-to-right.
  3. Close the tag — both tags are required.
  4. Use this when the surrounding context might otherwise reorder the span.

Example 3 — Show Logical (Stored) Order

MDN-style demo: natural RTL display vs forced LTR to reveal storage order.

HTML
<p>
  Looks like this in Hebrew:
  <span dir="rtl">אה, אני אוהב להיות ליד חוף הים</span>
</p>
<p>
  In the computer’s memory, this is stored as
  <bdo dir="ltr">אה, אני אוהב להיות ליד חוף הים</bdo>
</p>
Try It Yourself

How It Works

  1. First line: natural RTL rendering with dir="rtl" on a span.
  2. Second line: same characters inside <bdo dir="ltr">.
  3. Override reveals left-to-right storage/logical order for teaching or debugging.
  4. Same glyphs — only the layout direction changes.

Example 4 — bdo vs bdi

Force a known direction, or isolate unknown direction text.

HTML
<p>
  Forced RTL:
  <bdo dir="rtl">Hello CodeToFun</bdo>
</p>
<p>
  Isolated name:
  <bdi>مسافر</bdi> - 1st place
</p>
Try It Yourself

How It Works

  1. Choose <bdo> when you already know ltr or rtl.
  2. Choose <bdi> for usernames and other unknown-direction text.
  3. Always pair bdo with dir.
  4. Do not use override when isolation alone is enough.

Edge Cases & Pitfalls

Most mistakes come from missing dir or using override when isolation was enough.

required

Always set dir

Use ltr or rtl. An empty <bdo> without direction is not useful.

choice

Unknown direction → <bdi>

Do not force a wrong direction. Isolate with <bdi> instead.

glyphs

Characters are not mirrored

Override changes layout start side, not the drawing of each letter backward.

scope

Wrap only what you must override

Keep surrounding sentence text outside <bdo> unless the whole phrase should flip.

a11y

Prefer natural language direction when possible

Override is a special tool. For normal multilingual UI, mark language and use isolation carefully.

Browser Support

The <bdo> element is core HTML phrasing content for bidirectional override. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<bdo>

Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera honor dir="ltr" and dir="rtl" overrides.

97% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<bdo> Widely supported

Bottom line: Safe to use when you must force LTR or RTL. Prefer bdi for unknown-direction user content.

Key Takeaways

  • Role: <bdo> forces text direction with dir.
  • Values: use ltr or rtl — always set one.
  • vs bdi: override when known; isolate when unknown.
  • Glyphs: layout direction changes; letters are not drawn backward.

One line: use <bdo dir="ltr|rtl"> only when you must force direction.

Default CSS Settings

User agents typically apply a bidirectional override. A common idea looks like this:

default.css
bdo {
  unicode-bidi: bidi-override;
}

The actual direction still comes from the HTML dir attribute (ltr or rtl).

Frequently Asked Questions

The bdo (Bidirectional Override) element forces its contents to render left-to-right or right-to-left using the required dir attribute, overriding the Unicode bidirectional algorithm for that span.
Yes for useful behavior. Set dir to ltr or rtl. Without a direction, override has nothing meaningful to apply.
bdo forces a known direction (ltr or rtl). bdi isolates text and usually lets direction be detected automatically — better when you do not know the direction in advance.
No. Characters are laid out starting from the chosen side; glyphs are not mirrored or drawn backward.
Use it when you must display text in a specific direction regardless of the surrounding algorithm — for example to show logical/memory order of RTL text, or to force RTL layout of a known string.
Prefer ltr or rtl on bdo. For automatic isolation, use bdi (which behaves like dir="auto") instead of forcing an override.

Next: bgsound

See why the obsolete background-sound element should be replaced with audio.

bgsound tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful