CSS unicode-bidi Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Typography

What You’ll Learn

The unicode-bidi property helps browsers render mixed-direction text correctly — essential for Arabic, Hebrew, and English on the same page.

01

Bidi text

RTL + LTR mix.

02

direction

Pair together.

03

embed

New level.

04

isolate

Separate context.

05

Usernames

LTR in RTL UI.

06

i18n

Global sites.

Introduction

The unicode-bidi property in CSS is used to control the directionality and handling of text within an element. It primarily affects the bidirectional algorithm in text rendering, which is crucial for correctly displaying languages that are written from right to left (RTL) or mixed directionality.

Definition and Usage

Use unicode-bidi together with the direction property when you need fine control over how mixed scripts are ordered on screen. For whole-page direction, setting dir="rtl" on <html> or using direction is often enough; unicode-bidi helps with embedded snippets.

💡
Beginner Tip

Most day-to-day layouts use direction: rtl or direction: ltr. Reach for unicode-bidi when a small piece of opposite-direction text appears inside a paragraph and reads in the wrong order.

📝 Syntax

The syntax for the unicode-bidi property is simple. It accepts one of the following values:

syntax.css
element {
  unicode-bidi: normal | embed | isolate | bidi-override | isolate-override | plaintext;
}

Basic Example

unicode-bidi.css
.rtl {
  unicode-bidi: embed;
  direction: rtl;
}

Syntax Rules

  • Only one keyword value at a time.
  • Often paired with direction: ltr or direction: rtl.
  • embed and isolate are the most common values for mixed text.
  • bidi-override forces direction and should be used carefully.
  • The property is not inherited.

Related Properties

  • direction — sets base text direction (ltr or rtl)
  • writing-mode — controls vertical vs horizontal writing
  • text-align — horizontal alignment of text

🎯 Default Value

The default value of unicode-bidi is normal, which means the element follows the normal bidirectional behavior of its context.

⚡ Quick Reference

QuestionAnswer
Default valuenormal
RTL blockunicode-bidi: embed; direction: rtl;
Inline snippetunicode-bidi: isolate;
LTR email in RTL pageunicode-bidi: isolate; direction: ltr;
Usually paired withdirection
InheritedNo

💎 Property Values

The unicode-bidi property accepts keyword values that control bidirectional formatting.

ValueExampleDescription
normalunicode-bidi: normal;Inherit directional behavior from the normal bidi layout rules.
embedunicode-bidi: embed;Establish a new embedding level for bidirectional text.
isolateunicode-bidi: isolate;Create an independent directional formatting context.
bidi-overrideunicode-bidi: bidi-override;Force the directionality of the element’s text.
isolate-overrideunicode-bidi: isolate-override;Combines isolate and bidi-override in one isolated context.
plaintextunicode-bidi: plaintext;Determine direction from the first strong character in the text.
normal embed isolate bidi-override plaintext

When to Use unicode-bidi

unicode-bidi is helpful in international and multilingual interfaces:

  • Mixed Arabic and English — Keep phrases readable inside one paragraph.
  • RTL page with LTR data — Display emails, URLs, and codes left-to-right.
  • Quoted foreign text — Isolate a short RTL quote inside LTR content (or vice versa).
  • User-generated content — Prevent unpredictable bidi reordering in comments or chat.

👀 Live Preview

Same mixed text with default flow vs embed + direction: rtl:

Product: ABC-123 مرحبا
normal (default)
Product: ABC-123 مرحبا
embed + direction: rtl

Examples Gallery

In this example, we’ll use the unicode-bidi property to manage the directionality of a paragraph containing mixed-direction text.

📜 Core Patterns

Combine unicode-bidi with direction for blocks and inline mixed-direction text.

Example 1 — RTL embed with mixed text

In this example, we’ll use the unicode-bidi property to manage the directionality of a paragraph containing mixed-direction text.

index.html
<style>
  .rtl {
    unicode-bidi: embed;
    direction: rtl;
    border: 1px solid #000;
    padding: 10px;
  }
</style>

<div class="rtl">
  <p>مرحبا بالعالم Hello World</p>
</div>
Try It Yourself

How It Works

embed creates a new bidi level and direction: rtl sets the base direction so Arabic and English reorder correctly.

Example 2 — isolate for inline snippet

Wrap a short mixed-direction phrase so it does not disturb surrounding LTR text.

isolate.css
.quote {
  unicode-bidi: isolate;
  direction: rtl;
  display: inline;
}
Try It Yourself

How It Works

isolate creates a separate formatting context so neighbors are not affected by the snippet’s direction rules.

📄 UI Patterns

Handle direction blocks and LTR data inside RTL interfaces.

Example 3 — LTR vs RTL blocks

Compare the same mixed string in LTR and RTL embedding contexts.

blocks.css
.ltr { unicode-bidi: embed; direction: ltr; }
.rtl { unicode-bidi: embed; direction: rtl; }
Try It Yourself

How It Works

The same characters can appear in different visual order depending on the base direction and bidi level.

Example 4 — LTR username on RTL page

Keep emails and usernames readable with isolate and direction: ltr inside an RTL layout.

username.css
.username {
  unicode-bidi: isolate;
  direction: ltr;
  display: inline-block;
}
Try It Yourself

How It Works

Technical strings usually read LTR even on RTL pages. Isolating them prevents the @ symbol and numbers from jumping position.

♿ Accessibility

  • Set lang attributes — Use lang="ar", lang="he", or lang="en" on elements so screen readers pronounce text correctly.
  • Use dir on HTML — Prefer <html dir="rtl"> for page-wide direction when appropriate.
  • Avoid bidi-override for body text — Forcing direction can confuse readers and assistive technology.
  • Test with real content — Verify mixed numbers, punctuation, and URLs with native speakers when possible.

unicode-bidi + direction

These two properties work together. direction sets the inline base direction; unicode-bidi controls how embedding levels and overrides are applied.

bidi-pair.css
.rtl-block {
  unicode-bidi: embed;
  direction: rtl;
  text-align: right;
}

🧠 How unicode-bidi Works

1

Text contains mixed scripts

LTR and RTL characters appear in the same content.

Input
2

unicode-bidi sets bidi rules

Keywords like embed or isolate define formatting context.

Rules
3

Browser applies bidi algorithm

Characters reorder for correct visual reading direction.

Render
=

Readable mixed-direction text

Users see text in the intended visual order.

Browser Compatibility

The unicode-bidi property is supported in all major browsers, including Chrome, Firefox, Safari, Edge, and Opera. However, older browser versions may have limited support or behave differently, so it’s advisable to test across different browsers if targeting a wide audience.

Modern browsers · Widely supported

Bidirectional text support

All major browsers implement the Unicode bidirectional algorithm with CSS unicode-bidi and direction.

99% Browser support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions
Full support
Opera All versions
Full support

Testing tip

Test RTL layouts with real Arabic or Hebrew content and verify numbers, URLs, and punctuation behave as expected.

unicode-bidi property 99% supported

Bottom line: unicode-bidi is well supported for international text on the modern web.

Conclusion

The unicode-bidi property is essential for correctly rendering text in languages that require bidirectional handling.

By understanding and utilizing this property, web developers can ensure that their web pages display text accurately and in accordance with the intended directionality of the content.

💡 Best Practices

✅ Do

  • Pair unicode-bidi with direction when needed
  • Use isolate for emails, URLs, and usernames in opposite-direction UI
  • Set lang and dir on <html> for page-level i18n
  • Test mixed scripts with real multilingual content
  • Prefer embed or isolate over bidi-override for body text

❌ Don’t

  • Use bidi-override casually on readable paragraphs
  • Forget direction when using embed
  • Assume LTR CSS alone fixes RTL text ordering
  • Ignore accessibility lang attributes on mixed-language content

Key Takeaways

Knowledge Unlocked

Five things to remember about unicode-bidi

Use these points when handling bidirectional text.

5
Core concepts
🕐 02

normal

Default value.

Default
🔀 03

+ direction

Pair properties.

Syntax
🔒 04

isolate

Inline snippets.

Pattern
🌐 05

i18n

RTL support.

Use case

❓ Frequently Asked Questions

unicode-bidi controls how the Unicode bidirectional algorithm handles text direction inside an element, especially for mixed RTL and LTR content.
The default is normal, which means the element follows the normal bidirectional behavior inherited from its context.
Often yes. Many unicode-bidi values such as embed and bidi-override work together with direction set to ltr or rtl to control text flow.
Use isolate when a short RTL or LTR snippet inside opposite-direction text should not affect surrounding characters, such as usernames, emails, or quoted phrases.
No, unicode-bidi is not inherited. Set it on the element that needs special bidirectional handling.

Practice in the Live Editor

Open the HTML editor and test unicode-bidi with mixed Arabic and English text.

HTML Editor →

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.

5 people found this page helpful