The <bdi> element (Bidirectional Isolate) tells the browser’s bidirectional algorithm to treat its contents separately from surrounding text. Direction inside does not spill out, and surrounding direction does not force the isolated span.
Use it for usernames, titles, or other dynamic text whose direction you may not know (LTR Latin, RTL Arabic/Hebrew, or mixed). Prefer <bdo> only when you must force dir to ltr or rtl.
Baseline · Widely available.
Not deprecated. Stable across major browsers since about January 2020.
Default direction.
If you omit dir, <bdi> still behaves as if dir="auto" were set — direction is inferred from the text.
Syntax
HTML Syntax
syntax.html
<bdi>text</bdi>
Both start and end tags are required. Content is phrasing content. Optional dir="ltr", rtl, or auto (auto is the effective default).
Reference
Attributes
<bdi> has no element-specific attributes. It uses global attributes; these matter most:
Attribute
Description
Try it
(isolation built in)
No tag-only attributes — wrapping in <bdi> is enough for auto isolation
Prefer semantic HTML over CSS unicode-bidi: isolate for the same job.
Edge Cases & Pitfalls
Most bidi bugs show up next to punctuation, numbers, and user-generated names.
dynamic
Isolate unknown direction text
Usernames and CMS titles are classic <bdi> cases — you often cannot hard-code dir.
wrap
Wrap only the variable part
Keep fixed labels like “1st place” outside <bdi> so they stay in the page language direction.
css
Prefer <bdi> over CSS isolate
unicode-bidi: isolate is not semantic; browsers may ignore presentational CSS for this.
bdo
Do not confuse with <bdo>
<bdo> forces direction. Use it when you know ltr/rtl, not for auto isolation.
dir
dir="auto" is already implied
Omitting dir on <bdi> still isolates with automatic direction detection.
Compatibility
Browser Support
The <bdi> element is core HTML phrasing content for bidirectional isolation. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
<bdi>
Widely available since about January 2020. Chrome, Firefox, Safari, Edge, and Opera isolate bidirectional text. Always test with real RTL samples in your layout.
95%Global support (approx.)
Google ChromeYes
Full support
Mozilla FirefoxYes
Full support
Apple SafariYes
Full support
Microsoft EdgeYes
Full support
OperaYes
Full support
Samsung InternetYes
Full support
Internet ExplorerNo
Not supported
<bdi>Widely supported
Bottom line: Safe for modern sites that mix LTR and RTL user content. Provide sensible fallbacks only if you must support very old browsers.
Remember
Key Takeaways
Role:<bdi> isolates a text span for the bidirectional algorithm.
Use when: direction of inserted text is unknown or may be RTL inside LTR (or the reverse).
Default: omitting dir still means auto isolation.
Not bdo: force direction with <bdo>; isolate with <bdi>.
One line: wrap unpredictable names in <bdi> so nearby LTR/RTL text stays readable.
UA style
Default CSS Settings
User agents typically isolate the element for the Unicode bidirectional algorithm. A common idea looks like this:
default.css
bdi {
unicode-bidi: isolate;
}
You may add color or weight for design, but do not replace <bdi> with a non-semantic CSS-only isolate for authoring.
Frequently Asked Questions
The bdi (Bidirectional Isolate) element tells the browser to treat its text separately from surrounding text in the Unicode bidirectional algorithm. That keeps mixed LTR/RTL content — such as usernames next to rankings — from getting scrambled.
No element-specific attributes. It supports global attributes. If you omit dir, bdi still behaves as if dir="auto" were set, so direction is inferred from the content.
bdi isolates text and lets the algorithm pick direction (auto by default). bdo overrides direction and requires an explicit dir of ltr or rtl.
Use it when you insert text whose direction you do not know in advance — user names, product titles from a database, comments, and similar dynamic strings — inside a sentence or list with fixed surrounding text.
unicode-bidi: isolate on a span can look similar, but HTML authors should prefer bdi. It is semantic, and browsers may ignore presentational CSS for bidi.
Usually no. Use bdi when mixed directionality (or unknown directionality) can affect nearby punctuation and numbers.