# Bidirectional Text (Bidi)

> One line of text that runs two ways, right to left and left to right.

**Field:** Design  
**Category:** Typography  
**Also known as:** Bidi Text, Mixed-Direction Text, Unicode Bidirectional Algorithm

## Think of it like

It is like two cars on one street going opposite ways. Clear lanes keep them from crashing.

## Definition

Bidirectional text is a line that mixes right-to-left words with left-to-right ones. A Persian sentence with an English name or a number in it is a common case. The screen must show each part in its own direction. It must also keep the parts in the right order. A shared set of Unicode rules decides that order. On web pages, the bdi tag and dir="auto" help when the direction is not known.

## Example

In a chat app, someone types an English brand name inside an Arabic sentence. The rules keep the brand name reading left to right. The rest of the line still reads right to left.

## Example code

```html
<p dir="auto"><bdi>user_name</bdi> left a review</p>
```

The bdi tag keeps a name in its own direction. Then it cannot mix up the words around it.

## Why it matters

Mixed lines are everywhere in these languages. When the rules fail, words and brackets jump to the wrong place.

## Common mistake

Testing only with Arabic or only with English. Bugs show up in lines that mix both.

## Three principles

- **Two directions.** In one line.
- **Unicode decides.** A shared set of rules.
- **Isolate inserts.** Names and user text.

## Related terms

- [Right-to-Left Text (RTL)](https://learn.benibix.com/term/design/right-to-left-text)
- [Arabic Script](https://learn.benibix.com/term/design/arabic-script)
- [Unicode](https://learn.benibix.com/term/development/unicode)
- [8-bit Unicode Transformation Format (UTF-8)](https://learn.benibix.com/term/development/utf-8)

## Taught in

- [Right-to-Left and Arabic Type](https://learn.benibix.com/learn/design-typography/right-to-left-and-arabic-type): Typography, 17/17

![Four panels. Right to left: lines of text blocks lined up on the right edge, with an arrow pointing left. Mixed direction: a right-to-left line holding one English word whose own small arrow points right. Two styles of Arabic script, drawn as word shapes: Naskh words sitting on one flat line, and Nastaliq words each sloping down from right to left. Kashida: two joined word shapes, the second with its join stretched long so the line reaches the edge.](https://learn.benibix.com/diagrams/des7-rtl-scripts.svg)

---

Source: https://learn.benibix.com/term/design/bidirectional-text
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
