CSS unicode-bidi Property

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The unicode-bidi property works with direction to control how the Unicode bidirectional algorithm handles mixed left-to-right (LTR) and right-to-left (RTL) text.

The initial value is normal. It is not inherited. Values like embed, isolate, and bidi-override change embedding levels or force character order. Prefer the HTML dir attribute for everyday markup; use this property when you need precise embedding or isolation.

Warning Prefer HTML dir

MDN notes that unicode-bidi is intended mainly for DTD designers. Web authors should usually set direction with HTML dir instead of overriding bidi in CSS.

Baseline · Widely available.

Not deprecated. Standard-track CSS. Core values are ancient; isolate, isolate-override, and plaintext need modern browsers. Unaffected by the all shorthand (with direction).

CSS Syntax

syntax.css
unicode-bidi: normal | embed | isolate | bidi-override | isolate-override | plaintext | initial | inherit;

Examples: normal; · embed; · isolate; · bidi-override;

Property Values

ValueDescriptionTry it
normalDefault. No extra embedding levelTry it
embedOpens an embedding level; uses directionTry it
bidi-overrideForces strict order from direction; skips implicit reorderingTry it
isolateIsolates this element from siblings’ bidi resolutionTry it
isolate-override / plaintextIsolate + override, or compute direction from Unicode P2/P3 rulesTry it
initial / inheritReset to normal, or take the parent valueTry it

How to Use unicode-bidi

Pair a keyword with direction (or HTML dir) on the element that needs special bidi handling.

  1. Prefer HTML dir="ltr" / dir="rtl" for page or block direction when you can.
  2. Set direction when CSS embedding or override is required.
  3. Choose embed, isolate, or bidi-override for the behavior you need.
  4. Test mixed LTR/RTL snippets (names, punctuation, numbers) visually.
PieceRequired?Role
unicode-bidi keywordYes (to change behavior)Embedding, isolation, or override
direction / dirUsuallySets the base direction for embed / override
Mixed-script textTo see the effectLTR-only pages rarely need overrides
HTML firstRecommendedAuthors: prefer dir over CSS bidi overrides

Live Preview

Change unicode-bidi on the highlighted span. Direction stays rtl so override and embed are easy to compare.

Sample uses Latin letters with direction: rtl so bidi-override reverses visual order.

Sample

Hello ABCDEF world.

unicode-bidi: normal

CSS Examples

Each snippet focuses on unicode-bidi. direction is included only when the value needs it. Use Try It Yourself for a live editor.

Example 1 — Embed with Direction

Open an embedding level whose base direction comes from direction.

CSS
<style>
  .quote {
    direction: rtl;
    unicode-bidi: embed;
  }
</style>

<p>English before <span class="quote">مرحبا Hello</span> after.</p>
Try It Yourself

How It Works

  1. Set direction. rtl gives the embedding a right-to-left base.
  2. Add embed. The span opens an extra embedding level for the bidi algorithm.
  3. Mixed content. Arabic and Latin inside the span resolve within that level.
  4. Surrounding text. Outer LTR sentence still flows left to right around the span.

Example 2 — Bidi Override

Force characters to follow direction in storage order.

CSS
<style>
  .forced {
    direction: rtl;
    unicode-bidi: bidi-override;
  }
</style>

<p>Stored as ABCDEF: <span class="forced">ABCDEF</span></p>
Try It Yourself

How It Works

  1. direction: rtl. Base direction is right to left.
  2. bidi-override. Implicit letter reordering is ignored inside the span.
  3. Visual result. Latin ABCDEF paints as if walked RTL — often looking reversed.
  4. Use carefully. Override is powerful; prefer isolate for most UI snippets.

Example 3 — Isolate a Snippet

Keep a short opposite-direction phrase from affecting neighbors.

CSS
<style>
  .name {
    direction: rtl;
    unicode-bidi: isolate;
  }
</style>

<p>User: <span class="name">علي</span> (online)</p>
Try It Yourself

How It Works

  1. isolate. The span is treated like a replaced object for outer bidi resolution.
  2. Siblings stay stable. Punctuation and English around the name do not get pulled into the RTL run.
  3. direction: rtl. Sets the base for content inside the isolated span.
  4. Common UI fix. Usernames, emails, and quotes often need isolation in mixed-direction UIs.

Edge Cases & Pitfalls

If mixed text looks scrambled, check these first.

authors

Prefer HTML dir

For most pages, set direction in markup. Reserve CSS unicode-bidi for embedding/isolation cases you cannot express with dir alone.

pair

Needs direction for embed / override

embed and bidi-override take their base direction from direction. Without it, results may look unchanged.

all

Not reset by all

unicode-bidi and direction are the only properties the all shorthand does not affect.

support

Newer keywords need modern browsers

isolate, isolate-override, and plaintext arrived later than normal / embed / bidi-override.

a11y

Wrong override hurts readability

Forced order can reverse meaningful text. Prefer isolate for snippets; test with real RTL languages and screen readers.

Browser Support

unicode-bidi is a browser CSS property for bidirectional text. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

unicode-bidi

Core values (normal, embed, bidi-override) are widely supported. isolate, isolate-override, and plaintext need roughly Chrome 48+, Firefox 50+, Safari 11+, Edge 79+.

97% Core support
Google Chrome 2+ / 48+*
Full support
Mozilla Firefox 1+ / 50+*
Full support
Apple Safari 1.3+ / 11+*
Full support
Microsoft Edge 12+ / 79+*
Full support
Opera 15+ / 35+*
Full support
Samsung Internet 1+ / 5+*
Full support
Internet Explorer 5.5+
Core values
unicode-bidi Widely supported

Bottom line: *Newer keywords (isolate / isolate-override / plaintext). Safe to teach; prefer HTML dir for authors. It is not a runtime API.

Key Takeaways

  • Role: control bidi embedding / isolation with direction.
  • Initial value: normal — no extra embedding level.
  • isolate vs override: protect neighbors vs force character order.
  • Authors: prefer HTML dir; treat CSS bidi as advanced.

One line: direction sets base flow; unicode-bidi decides how embedding and isolation work.

Frequently Asked Questions

Together with direction, it controls how the Unicode bidirectional algorithm embeds or isolates mixed left-to-right and right-to-left text.
The initial value is normal — the element does not add an extra embedding level; implicit bidi reordering still applies.
MDN warns that unicode-bidi is mainly for DTD designers. Prefer HTML dir attributes for everyday pages; use CSS unicode-bidi only when you truly need embedding or isolation control.
Use isolate for short opposite-direction snippets (names, emails, quotes) so they do not reorder surrounding punctuation or text.
It forces characters to follow direction in strict storage order, ignoring the usual implicit bidi reordering inside the element.
Core values are Baseline Widely available. isolate, isolate-override, and plaintext need modern engines (roughly Chrome 48+, Firefox 50+, Safari 11+). It is a browser CSS property, not a Node.js feature.

Next: user-select

Learn how user-select controls text selection behavior.

user-select 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.

8 people found this page helpful