Codectionary / Developer documentation / HTML

<bdi> and <bdo>

These elements handle bidirectional text — content that mixes left-to-right languages (like English) with right-to-left languages (like Arabic or Hebrew). <bdi> isolates a piece of text so its directionality does not affect surrounding text, useful for user-generated content like usernames where the language is unknown ahead of time. <bdo> explicitly overrides the natural text direction for its content.

Syntax

<bdi>Username</bdi>
<bdo dir="rtl">Reversed direction text</bdo>

Examples

Isolating User-Generated Content

Preventing an unknown-direction username from disrupting surrounding layout.

<ul>
  <li><bdi>Ahmad</bdi>: 95 points</li>
  <li><bdi>Fatima</bdi>: 88 points</li>
</ul>

Forcing Right-to-Left Direction

Using bdo to override the natural rendering direction.

<p>Normal direction text.</p>
<bdo dir="rtl">This text is forced right-to-left.</bdo>

Attributes

  • dir (ltr | rtl): Used on <bdo> to specify the forced text direction

Best practices

  • Use <bdi> when displaying user-generated text (like names) whose language direction is not known in advance
  • Use <bdo> sparingly, only when you genuinely need to override natural text direction, not for styling
  • Prefer the CSS unicode-bidi and direction properties for broader layout-level direction control
  • Test bidirectional content with real right-to-left text (Arabic, Hebrew) rather than assuming it works

Browser compatibility

Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.

<bdi>

Desktop

Chrome
Supported
From 16
Firefox
Supported
From 10
Safari
Supported
From 6
Edge
Supported
From 79
Opera
Supported
From 15

Mobile

Safari on iOS
Supported
From 6
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 10
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 16

Firefox

  • From 10

Safari

  • From 6

Edge

  • From 79

Opera

  • From 15

Safari on iOS

  • From 6

Chrome for Android

  • From 18

Firefox for Android

  • From 10

Samsung Internet

  • From 1.0
<bdo>

Desktop

Chrome
Supported
By 15 (possibly earlier)
Firefox
Supported
From 10
Safari
Supported
By 4 (possibly earlier)
Edge
Supported
From 12
Opera
Supported
From 15

Mobile

Safari on iOS
Supported
By 3.2 (possibly earlier)
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 10
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • By 15 (possibly earlier)

Firefox

  • From 10

Safari

  • By 4 (possibly earlier)

Edge

  • From 12

Opera

  • From 15

Safari on iOS

  • By 3.2 (possibly earlier)

Chrome for Android

  • From 18

Firefox for Android

  • From 10

Samsung Internet

  • From 1.0
dir

Desktop

Chrome
Supported
From 1
Firefox
Supported
From 1
Safari
Supported
By 4 (possibly earlier)
Edge
Supported
By 15 (possibly earlier)
Opera
Supported
From 15

Mobile

Safari on iOS
Supported
By 3.2 (possibly earlier)
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 1

Firefox

  • From 1

Safari

  • By 4 (possibly earlier)

Edge

  • By 15 (possibly earlier)

Opera

  • From 15

Safari on iOS

  • By 3.2 (possibly earlier)

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0

MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.

HTML Living Standard

Specifications & further reading